Browse Source

Make sure we don't empty the outq and leave the write callback enabled.

master
Richard Nyberg 19 years ago
parent
commit
bf2c2c6338
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      btpd/peer.c

+ 10
- 0
btpd/peer.c View File

@@ -310,6 +310,8 @@ peer_on_cancel(struct peer *p, uint32_t index, uint32_t begin,
uint32_t length)
{
struct nb_link *nl = BTPDQ_FIRST(&p->outq);
if (nl == NULL)
return;
while (nl != NULL) {
if (nl->nb->info.type == NB_PIECE
&& nl->nb->info.index == index
@@ -327,6 +329,14 @@ peer_on_cancel(struct peer *p, uint32_t index, uint32_t begin,
}
nl = BTPDQ_NEXT(nl, entry);
}

if (BTPDQ_EMPTY(&p->outq)) {
if (p->flags & PF_ON_WRITEQ) {
BTPDQ_REMOVE(&btpd.writeq, p, wq_entry);
p->flags &= ~PF_ON_WRITEQ;
} else
event_del(&p->out_ev);
}
}

int


Loading…
Cancel
Save