From 3c0e61e112476a3d5b98431a13aeafff46541c3d Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Mon, 16 Jan 2006 17:13:19 +0000 Subject: [PATCH] A peer needs to be removed from the peer list before being handed to dl_on_lost_peer. Fix a type. --- btpd/peer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/btpd/peer.c b/btpd/peer.c index f043056..2b06a9f 100644 --- a/btpd/peer.c +++ b/btpd/peer.c @@ -17,12 +17,12 @@ peer_kill(struct peer *p) btpd_log(BTPD_L_CONN, "killed peer %p\n", p); if (p->flags & PF_ATTACHED) { + BTPDQ_REMOVE(&p->n->peers, p, p_entry); + p->n->npeers--; if (p->n->active) { ul_on_lost_peer(p); dl_on_lost_peer(p); } - BTPDQ_REMOVE(&p->n->peers, p, p_entry); - p->n->npeers--; } else BTPDQ_REMOVE(&net_unattached, p, p_entry); 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", index, begin, length, p); if ((p->flags & PF_NO_REQUESTS) == 0) { - char *content; + uint8_t *content; 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_torrentdata(content, length));