diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-03-16 17:48:42 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-03-16 17:48:42 +0000 |
| commit | cdb471d0acf5854a9b53aaec6812344d7f624d72 (patch) | |
| tree | 1eb1e21151d5eaa4a6505d1fbf84a0ed088434b8 | |
| parent | 9f4070eeb80442607c60d50f5f32d31cdb8e17d3 (diff) | |
| download | btpd-cdb471d0acf5854a9b53aaec6812344d7f624d72.tar.gz btpd-cdb471d0acf5854a9b53aaec6812344d7f624d72.zip | |
Fix a bug from the last commit: shared messages for endgame requests could
be placed at the wrong index in the array.
| -rw-r--r-- | btpd/download_subr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/btpd/download_subr.c b/btpd/download_subr.c index c78f5b1..a38e553 100644 --- a/btpd/download_subr.c +++ b/btpd/download_subr.c @@ -329,7 +329,6 @@ dl_new_request(struct peer *p, struct piece *pc, struct net_buf *msg) set_bit(pc->down_field, pc->next_block); pc->nbusy++; } - INCNEXTBLOCK(pc); peer_request(p, req); return req; } @@ -350,6 +349,7 @@ dl_piece_assign_requests(struct piece *pc, struct peer *p) || has_bit(pc->down_field, pc->next_block))) INCNEXTBLOCK(pc); dl_new_request(p, pc, NULL); + INCNEXTBLOCK(pc); count++; } while (!piece_full(pc) && !peer_laden(p)); @@ -447,12 +447,13 @@ dl_piece_assign_requests_eg(struct piece *pc, struct peer *p) INCNEXTBLOCK(pc); continue; } - struct block_request *req = + struct block_request *req = dl_new_request(p, pc, pc->eg_reqs[pc->next_block]); if (pc->eg_reqs[pc->next_block] == NULL) { pc->eg_reqs[pc->next_block] = req->msg; nb_hold(req->msg); } + INCNEXTBLOCK(pc); } while (!peer_laden(p) && pc->next_block != first_block); } |