Browse Source

Fix a bug from the last commit: shared messages for endgame requests could

be placed at the wrong index in the array.
master
Richard Nyberg 19 years ago
parent
commit
cdb471d0ac
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      btpd/download_subr.c

+ 3
- 2
btpd/download_subr.c View File

@@ -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); set_bit(pc->down_field, pc->next_block);
pc->nbusy++; pc->nbusy++;
} }
INCNEXTBLOCK(pc);
peer_request(p, req); peer_request(p, req);
return 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))) || has_bit(pc->down_field, pc->next_block)))
INCNEXTBLOCK(pc); INCNEXTBLOCK(pc);
dl_new_request(p, pc, NULL); dl_new_request(p, pc, NULL);
INCNEXTBLOCK(pc);
count++; count++;
} while (!piece_full(pc) && !peer_laden(p)); } while (!piece_full(pc) && !peer_laden(p));


@@ -447,12 +447,13 @@ dl_piece_assign_requests_eg(struct piece *pc, struct peer *p)
INCNEXTBLOCK(pc); INCNEXTBLOCK(pc);
continue; continue;
} }
struct block_request *req = struct block_request *req =
dl_new_request(p, pc, pc->eg_reqs[pc->next_block]); dl_new_request(p, pc, pc->eg_reqs[pc->next_block]);
if (pc->eg_reqs[pc->next_block] == NULL) { if (pc->eg_reqs[pc->next_block] == NULL) {
pc->eg_reqs[pc->next_block] = req->msg; pc->eg_reqs[pc->next_block] = req->msg;
nb_hold(req->msg); nb_hold(req->msg);
} }
INCNEXTBLOCK(pc);
} while (!peer_laden(p) && pc->next_block != first_block); } while (!peer_laden(p) && pc->next_block != first_block);
} }




||||||
x
 
000:0
Loading…
Cancel
Save