about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--btpd/net.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/btpd/net.c b/btpd/net.c
index 845cc75..8dadfa7 100644
--- a/btpd/net.c
+++ b/btpd/net.c
@@ -231,6 +231,10 @@ net_write(struct peer *p, unsigned long wmax)
 	    peer_kill(p);
 	    return 0;
 	}
+    } else if (nwritten == 0) {
+	btpd_log(BTPD_L_CONN, "connection close by peer.\n");
+	peer_kill(p);
+	return 0;
     }
 
     bcount = nwritten;