浏览代码

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

master
Richard Nyberg 19 年前
父节点
当前提交
bf2c2c6338
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. +10
    -0
      btpd/peer.c

+ 10
- 0
btpd/peer.c 查看文件

@@ -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


正在加载...
取消
保存