about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--btpd/peer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/btpd/peer.c b/btpd/peer.c
index dce170f..7ce486d 100644
--- a/btpd/peer.c
+++ b/btpd/peer.c
@@ -30,9 +30,9 @@ peer_kill(struct peer *p)
     if (p->flags & PF_ON_WRITEQ)
         BTPDQ_REMOVE(&net_bw_writeq, p, wq_entry);
 
-    close(p->sd);
     btpd_ev_del(&p->in_ev);
     btpd_ev_del(&p->out_ev);
+    close(p->sd);
 
     nl = BTPDQ_FIRST(&p->outq);
     while (nl != NULL) {