diff --git a/src/api/api_lib.c b/src/api/api_lib.c index abf4edb0..3a87c297 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -85,8 +85,10 @@ netconn_apimsg(tcpip_callback_fn fn, struct api_msg *apimsg) apimsg->op_completed_sem = LWIP_NETCONN_THREAD_SEM_GET(); #endif /* LWIP_NETCONN_SEM_PER_THREAD */ - tcpip_send_msg_wait_sem(fn, apimsg, LWIP_API_MSG_SEM(apimsg)); - return apimsg->err; + if (tcpip_send_msg_wait_sem(fn, apimsg, LWIP_API_MSG_SEM(apimsg)) == ERR_OK) { + return apimsg->err; + } + return ERR_VAL; } /** @@ -396,7 +398,7 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn) /* Let the stack know that we have accepted the connection. */ API_MSG_VAR_ALLOC_DONTFAIL(msg); API_MSG_VAR_REF(msg).conn = newconn; - /* don't care for the return value of lwip_netconn_do_accepted */ + /* don't care for the return value of lwip_netconn_do_recv */ netconn_apimsg(lwip_netconn_do_accepted, &API_MSG_VAR_REF(msg)); API_MSG_VAR_FREE(msg); #endif /* TCP_LISTEN_BACKLOG */ diff --git a/src/api/tcpip.c b/src/api/tcpip.c index a4507918..14ab29c0 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -314,8 +314,9 @@ tcpip_untimeout(sys_timeout_handler h, void *arg) * @param fn function to be called from TCPIP thread * @param apimsg argument to API function * @param sem semaphore to wait on + * @return ERR_OK if the function was called, another err_t if not */ -void +err_t tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem) { #if LWIP_TCPIP_CORE_LOCKING @@ -323,6 +324,7 @@ tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem) LOCK_TCPIP_CORE(); fn(apimsg); UNLOCK_TCPIP_CORE(); + return ERR_OK; #else /* LWIP_TCPIP_CORE_LOCKING */ LWIP_ASSERT("semaphore not initialized", sys_sem_valid(sem)); @@ -337,6 +339,7 @@ tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem) sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); sys_arch_sem_wait(sem, 0); TCPIP_MSG_VAR_FREE(msg); + return ERR_OK; #endif /* LWIP_TCPIP_CORE_LOCKING */ } diff --git a/src/include/lwip/priv/tcpip_priv.h b/src/include/lwip/priv/tcpip_priv.h index 278c1103..c754e3d0 100644 --- a/src/include/lwip/priv/tcpip_priv.h +++ b/src/include/lwip/priv/tcpip_priv.h @@ -92,7 +92,7 @@ struct netif; #define API_MSG_M_DEF_C(t, m) const t * m #endif /* LWIP_MPU_COMPATIBLE */ -void tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem); +err_t tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem); struct tcpip_api_call_data {