diff --git a/src/api/api_lib.c b/src/api/api_lib.c index b2670d02..244c4ecb 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -329,7 +329,7 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn) /* Let the stack know that we have accepted the connection. */ msg.msg.conn = conn; /* don't care for the return value of do_recv */ - TCPIP_APIMSG(&msg, do_recv, err); + TCPIP_APIMSG_NOERR(&msg, do_recv); #endif /* TCP_LISTEN_BACKLOG */ *new_conn = newconn; @@ -400,7 +400,7 @@ netconn_recv_data(struct netconn *conn, void **new_buf) msg.msg.msg.r.len = 1; } /* don't care for the return value of do_recv */ - TCPIP_APIMSG(&msg, do_recv, err); + TCPIP_APIMSG_NOERR(&msg, do_recv); } /* If we are closed, we indicate that we no longer wish to use the socket */ @@ -532,14 +532,13 @@ netconn_recved(struct netconn *conn, u32_t length) if ((conn != NULL) && (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) && (netconn_get_noautorecved(conn))) { struct api_msg msg; - err_t err; /* Let the stack know that we have taken the data. */ /* TODO: Speedup: Don't block and wait for the answer here (to prevent multiple thread-switches). */ msg.msg.conn = conn; msg.msg.msg.r.len = length; /* don't care for the return value of do_recv */ - TCPIP_APIMSG(&msg, do_recv, err); + TCPIP_APIMSG_NOERR(&msg, do_recv); } #else /* LWIP_TCP */ LWIP_UNUSED_ARG(conn); diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/tcpip.h index d0509f56..04567f2c 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/tcpip.h @@ -64,11 +64,14 @@ extern sys_mutex_t lock_tcpip_core; #else #define TCIP_APIMSG_SET_ERR(m, e) #endif -#define TCPIP_APIMSG(m,f,e) do { \ +#define TCPIP_APIMSG_NOERR(m,f) do { \ TCIP_APIMSG_SET_ERR(m, ERR_VAL); \ LOCK_TCPIP_CORE(); \ f(&((m)->msg)); \ UNLOCK_TCPIP_CORE(); \ +} while(0) +#define TCPIP_APIMSG(m,f,e) do { \ + TCPIP_APIMSG_NOERR(m,f); \ (e) = (m)->msg.err; \ } while(0) #define TCPIP_APIMSG_ACK(m) @@ -77,6 +80,7 @@ extern sys_mutex_t lock_tcpip_core; #else /* LWIP_TCPIP_CORE_LOCKING */ #define LOCK_TCPIP_CORE() #define UNLOCK_TCPIP_CORE() +#define TCPIP_APIMSG_NOERR(m,f) do { (m)->function = f; tcpip_apimsg(m); } while(0) #define TCPIP_APIMSG(m,f,e) do { (m)->function = f; (e) = tcpip_apimsg(m); } while(0) #define TCPIP_APIMSG_ACK(m) sys_sem_signal(&m->conn->op_completed) #define TCPIP_NETIFAPI(m) tcpip_netifapi(m)