From 6bfa99a7749f5ce37ecde7d13bb99ec11cd8990e Mon Sep 17 00:00:00 2001 From: fbernon Date: Sat, 19 May 2007 13:54:56 +0000 Subject: [PATCH] Minor fixs to reduce footprint on the "recv part" of Sequential API... --- src/api/api_lib.c | 4 ++++ src/api/sockets.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 0762afc2..d5dd85bc 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -475,6 +475,7 @@ netconn_recv(struct netconn *conn) } if (conn->type == NETCONN_TCP) { +#if LWIP_TCP if (conn->pcb.tcp->state == LISTEN) { conn->err = ERR_CONN; return NULL; @@ -524,7 +525,9 @@ netconn_recv(struct netconn *conn) msg.msg.msg.len = 1; } tcpip_apimsg(&msg); +#endif /* LWIP_TCP */ } else { +#if (LWIP_UDP || LWIP_RAW) #if LWIP_SO_RCVTIMEO sys_mbox_fetch_timeout(conn->recvmbox, (void *)&buf, conn->recv_timeout); #else @@ -536,6 +539,7 @@ netconn_recv(struct netconn *conn) if (conn->callback) (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len); } +#endif /* (LWIP_UDP || LWIP_RAW) */ } LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_recv: received %p (err %d)\n", (void *)buf, conn->err)); diff --git a/src/api/sockets.c b/src/api/sockets.c index 1edf50f8..f1c8a15b 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -437,7 +437,7 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags, /* If this is a TCP socket, check if there is data left in the buffer. If so, it should be saved in the sock structure for next time around. */ - if (netconn_type(sock->conn) == NETCONN_TCP && buflen - copylen > 0) { + if ((sock->conn->type == NETCONN_TCP) && (buflen - copylen > 0)) { sock->lastdata = buf; sock->lastoffset += copylen; } else { @@ -480,7 +480,7 @@ lwip_send(int s, const void *data, int size, unsigned int flags) #else sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1; -#endif +#endif /* (LWIP_UDP || LWIP_RAW) */ err = netconn_write( sock->conn, data, size, NETCONN_COPY);