summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2005-07-21 15:09:40 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2005-07-21 15:09:40 +0000
commit3f6e3845680a744ac2a157e01696a67cdb66daa6 (patch)
treebaf15bbd0c94603fcb987a5bb605bcda1bd9c1ea
parent2904cdca2d230155139680729bc11b033b4b4d93 (diff)
downloadbtpd-3f6e3845680a744ac2a157e01696a67cdb66daa6.tar.gz
btpd-3f6e3845680a744ac2a157e01696a67cdb66daa6.zip
No need to test piece_full in end game mode.
Added test for program correctness.

-rw-r--r--btpd/policy_if.c4
1 files changed, 3 insertions, 1 deletions
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);
     }
 }