From d1ef610822c4a69ffed693d2a0ee5e4a47e8aaa5 Mon Sep 17 00:00:00 2001 From: fbernon Date: Tue, 22 May 2007 21:29:04 +0000 Subject: [PATCH] Minor fix (spaces, indent) and check for LWIP_SO_RCVTIMEO.. --- src/api/api_lib.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index df3e5cbb..a1b8ee70 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -490,17 +490,16 @@ netconn_recv(struct netconn *conn) sys_arch_mbox_fetch(conn->recvmbox, (void *)&p, 0); - if (p != NULL) - { - len = p->tot_len; - conn->recv_avail -= len; + if (p != NULL) { + len = p->tot_len; + conn->recv_avail -= len; + } else { + len = 0; } - else - len = 0; /* Register event with callback */ - if (conn->callback) - (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, len); + if (conn->callback) + (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, len); /* If we are closed, we indicate that we no longer wish to receive data by setting conn->recvmbox to SYS_MBOX_NULL. */ @@ -529,16 +528,18 @@ netconn_recv(struct netconn *conn) } else { #if (LWIP_UDP || LWIP_RAW) #if LWIP_SO_RCVTIMEO - sys_arch_mbox_fetch(conn->recvmbox, (void *)&buf, conn->recv_timeout); + if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&buf, conn->recv_timeout)==SYS_ARCH_TIMEOUT) { + buf = NULL; + } #else sys_arch_mbox_fetch(conn->recvmbox, (void *)&buf, 0); #endif /* LWIP_SO_RCVTIMEO*/ - if (buf!=NULL) - { conn->recv_avail -= buf->p->tot_len; - /* Register event with callback */ - if (conn->callback) - (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len); - } + if (buf!=NULL) { + conn->recv_avail -= buf->p->tot_len; + /* Register event with callback */ + if (conn->callback) + (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len); + } #endif /* (LWIP_UDP || LWIP_RAW) */ }