diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-03-18 20:28:46 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-03-18 20:28:46 +0000 |
| commit | db497638492bba06ce2a27f39bf72c6acaa395dc (patch) | |
| tree | 2d018a8f953650517896231f96b9bd075a670b6c | |
| parent | b72b6bb8ba1bcd3030565159ee09f39fe7353379 (diff) | |
| download | btpd-db497638492bba06ce2a27f39bf72c6acaa395dc.tar.gz btpd-db497638492bba06ce2a27f39bf72c6acaa395dc.zip | |
The previous commit was a bit over zealous; the block field should not be
cleared for a failed piece in the full torrent test. This also fixes a bug where the content byte count wasn't decreased for failed pieces.
| -rw-r--r-- | btpd/content.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/btpd/content.c b/btpd/content.c index d86d596..9521610 100644 --- a/btpd/content.c +++ b/btpd/content.c @@ -562,10 +562,8 @@ test_torrent(struct torrent *tp, volatile sig_atomic_t *cancel) break; if (test_hash(tp, hash, piece) == 0) set_bit(tp->cm->piece_field, piece); - else { + else clear_bit(tp->cm->piece_field, piece); - bzero(cm->block_field + piece * cm->bppbf, cm->bppbf); - } if (*cancel) { err = EINTR; break; @@ -741,8 +739,10 @@ cm_td_start(struct cm_op *op) if (ok) { set_bit(cm->pos_field, piece); set_bit(cm->piece_field, piece); - } else + } else { bzero(bf, cm->bppbf); + cm->ncontent_bytes -= torrent_piece_size(tp, piece); + } } else if (nblocks_got > 0) set_bit(cm->pos_field, piece); } |