called after removing the last request.master
@@ -415,6 +415,9 @@ dl_unassign_requests(struct peer *p) | |||||
req = next; | req = next; | ||||
} | } | ||||
if (p->nreqs_out == 0) | |||||
peer_on_no_reqs(p); | |||||
if (was_full && !piece_full(pc)) | if (was_full && !piece_full(pc)) | ||||
dl_on_piece_unfull(pc); | dl_on_piece_unfull(pc); | ||||
} | } | ||||
@@ -497,6 +500,7 @@ dl_unassign_requests_eg(struct peer *p) | |||||
} | } | ||||
} | } | ||||
assert(BTPDQ_EMPTY(&p->my_reqs)); | assert(BTPDQ_EMPTY(&p->my_reqs)); | ||||
peer_on_no_reqs(p); | |||||
pc = BTPDQ_FIRST(&tmp); | pc = BTPDQ_FIRST(&tmp); | ||||
while (pc != NULL) { | while (pc != NULL) { | ||||
@@ -369,8 +369,6 @@ peer_on_choke(struct peer *p) | |||||
if ((p->flags & PF_P_CHOKE) != 0) | if ((p->flags & PF_P_CHOKE) != 0) | ||||
return; | return; | ||||
else { | else { | ||||
if (p->nreqs_out > 0) | |||||
peer_on_no_reqs(p); | |||||
p->flags |= PF_P_CHOKE; | p->flags |= PF_P_CHOKE; | ||||
dl_on_choke(p); | dl_on_choke(p); | ||||
struct nb_link *nl = BTPDQ_FIRST(&p->outq); | struct nb_link *nl = BTPDQ_FIRST(&p->outq); | ||||