From 0c794ac33a5359137ae044220addb731627908c0 Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Thu, 21 Jul 2005 09:29:19 +0000 Subject: The test for if we should call cm_on_undownload or not wasn't totally correct. Since there's a possibility that we've assigned requests to peer and then decreased the wanted level, we could've missed peers with requests but a wanted level of zero. Now we check if the peer has any requests instead. --- btpd/policy_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btpd/policy_if.c b/btpd/policy_if.c index 5f6804c..882767a 100644 --- a/btpd/policy_if.c +++ b/btpd/policy_if.c @@ -81,7 +81,7 @@ cm_on_undownload(struct peer *p) void cm_on_choke(struct peer *p) { - if (peer_wanted(p)) + if (p->nreqs_out > 0) cm_on_undownload(p); } @@ -217,7 +217,7 @@ cm_on_lost_peer(struct peer *p) if (peer_has(p, i)) tp->piece_count[i]--; - if (peer_leech_ok(p)) + if (p->nreqs_out > 0) cm_on_undownload(p); #if 0 struct piece *pc = BTPDQ_FIRST(&tp->getlst); -- cgit 1.4.1