From 3f6e3845680a744ac2a157e01696a67cdb66daa6 Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Thu, 21 Jul 2005 15:09:40 +0000 Subject: [PATCH] No need to test piece_full in end game mode. Added test for program correctness. --- btpd/policy_if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/btpd/policy_if.c b/btpd/policy_if.c index 882767a..33611fd 100644 --- a/btpd/policy_if.c +++ b/btpd/policy_if.c @@ -32,7 +32,7 @@ cm_on_piece_ann(struct peer *p, uint32_t index) return; struct piece *pc = torrent_get_piece(tp, index); if (tp->endgame) { - if (pc != NULL && !piece_full(pc)) { + if (pc != NULL) { peer_want(p, index); if (!peer_chokes(p)) cm_piece_assign_requests_eg(pc, p); @@ -139,6 +139,8 @@ cm_on_ok_piece(struct piece *pc) if (torrent_has_all(tp)) { btpd_log(BTPD_L_BTPD, "Finished: %s.\n", tp->relpath); tracker_req(tp, TR_COMPLETED); + BTPDQ_FOREACH(p, &tp->peers, cm_entry) + assert(p->nwant == 0); } }