瀏覽代碼

A peer needs to be removed from the peer list before being handed to

dl_on_lost_peer.
Fix a type.
master
Richard Nyberg 19 年之前
父節點
當前提交
3c0e61e112
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. +3
    -3
      btpd/peer.c

+ 3
- 3
btpd/peer.c 查看文件

@@ -17,12 +17,12 @@ peer_kill(struct peer *p)
btpd_log(BTPD_L_CONN, "killed peer %p\n", p); btpd_log(BTPD_L_CONN, "killed peer %p\n", p);


if (p->flags & PF_ATTACHED) { if (p->flags & PF_ATTACHED) {
BTPDQ_REMOVE(&p->n->peers, p, p_entry);
p->n->npeers--;
if (p->n->active) { if (p->n->active) {
ul_on_lost_peer(p); ul_on_lost_peer(p);
dl_on_lost_peer(p); dl_on_lost_peer(p);
} }
BTPDQ_REMOVE(&p->n->peers, p, p_entry);
p->n->npeers--;
} else } else
BTPDQ_REMOVE(&net_unattached, p, p_entry); BTPDQ_REMOVE(&net_unattached, p, p_entry);
if (p->flags & PF_ON_READQ) if (p->flags & PF_ON_READQ)
@@ -475,7 +475,7 @@ peer_on_request(struct peer *p, uint32_t index, uint32_t begin,
btpd_log(BTPD_L_MSG, "received request(%u,%u,%u) from %p\n", btpd_log(BTPD_L_MSG, "received request(%u,%u,%u) from %p\n",
index, begin, length, p); index, begin, length, p);
if ((p->flags & PF_NO_REQUESTS) == 0) { if ((p->flags & PF_NO_REQUESTS) == 0) {
char *content; uint8_t *content;
if (cm_get_bytes(p->n->tp, index, begin, length, &content) == 0) { if (cm_get_bytes(p->n->tp, index, begin, length, &content) == 0) {
peer_send(p, nb_create_piece(index, begin, length)); peer_send(p, nb_create_piece(index, begin, length));
peer_send(p, nb_create_torrentdata(content, length)); peer_send(p, nb_create_torrentdata(content, length));


||||||
x
 
000:0
Loading…
取消
儲存