Browse Source

Clear flag for busy blocks when entering end game.

Add test for program correctness.
master
Richard Nyberg 19 years ago
parent
commit
c25ede2479
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      btpd/policy_subr.c

+ 7
- 1
btpd/policy_subr.c View File

@@ -51,10 +51,16 @@ static void
cm_enter_endgame(struct torrent *tp) cm_enter_endgame(struct torrent *tp)
{ {
struct peer *p; struct peer *p;
struct piece *pc;
btpd_log(BTPD_L_POL, "Entering end game\n"); btpd_log(BTPD_L_POL, "Entering end game\n");
tp->endgame = 1; tp->endgame = 1;
BTPDQ_FOREACH(pc, &tp->getlst, entry) {
for (uint32_t i = 0; i < pc->nblocks; i++)
clear_bit(pc->down_field, i);
pc->nbusy = 0;
}
BTPDQ_FOREACH(p, &tp->peers, cm_entry) { BTPDQ_FOREACH(p, &tp->peers, cm_entry) {
struct piece *pc;
assert(p->nwant == 0);
BTPDQ_FOREACH(pc, &tp->getlst, entry) { BTPDQ_FOREACH(pc, &tp->getlst, entry) {
if (peer_has(p, pc->index)) { if (peer_has(p, pc->index)) {
peer_want(p, pc->index); peer_want(p, pc->index);


Loading…
Cancel
Save