about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2005-10-04 19:21:08 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2005-10-04 19:21:08 +0000
commit062d08cb6097f36a26a228f9b02632f337386c79 (patch)
treeea73df0ced40a436612299fe07ae80ce1ab8cc0c
parentf96307298394731936997bf73eb5f325925b1fda (diff)
downloadbtpd-062d08cb6097f36a26a228f9b02632f337386c79.tar.gz
btpd-062d08cb6097f36a26a228f9b02632f337386c79.zip
net_state should return ssize_t not int.
removed some deug logging.

-rw-r--r--btpd/net.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/btpd/net.c b/btpd/net.c
index 55731a7..98e4c6a 100644
--- a/btpd/net.c
+++ b/btpd/net.c
@@ -214,7 +214,7 @@ net_progress(struct peer *p, size_t length)
     }
 }
 
-static int
+static ssize_t
 net_state(struct peer *p, struct io_buffer *iob)
 {
     switch (p->net_state) {
@@ -259,14 +259,11 @@ net_state(struct peer *p, struct io_buffer *iob)
 	return 4;
     case NET_MSGHEAD:
 	p->msg_num = iob->buf[0];
-	if (!net_mh_ok(p)) {
-	    btpd_log(BTPD_L_ERROR, "error in head\n");
+	if (!net_mh_ok(p))
 	    goto bad;
-	} else if (p->msg_len == 1) {
-	    if (net_dispatch_msg(p, iob->buf) != 0) {
-		btpd_log(BTPD_L_ERROR, "error in dispatch\n");
+	else if (p->msg_len == 1) {
+	    if (net_dispatch_msg(p, iob->buf) != 0)
 		goto bad;
-	    }
 	    net_set_state(p, NET_MSGSIZE, 4);
 	} else {
 	    uint8_t nstate =
@@ -276,10 +273,8 @@ net_state(struct peer *p, struct io_buffer *iob)
 	return 1;
     case NET_MSGPIECE:
     case NET_MSGBODY:
-	if (net_dispatch_msg(p, iob->buf) != 0) {
-	    btpd_log(BTPD_L_ERROR, "error in dispatch\n");
+	if (net_dispatch_msg(p, iob->buf) != 0)
 	    goto bad;
-	}
 	net_set_state(p, NET_MSGSIZE, 4);
 	return p->msg_len - 1;
     default: