mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
Minor code cleanup api_lib.c
This commit is contained in:
parent
f488c5b7bc
commit
c21763f6cb
@ -390,7 +390,6 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn)
|
|||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
void *accept_ptr;
|
void *accept_ptr;
|
||||||
struct netconn *newconn;
|
struct netconn *newconn;
|
||||||
err_t err;
|
|
||||||
#if TCP_LISTEN_BACKLOG
|
#if TCP_LISTEN_BACKLOG
|
||||||
API_MSG_VAR_DECLARE(msg);
|
API_MSG_VAR_DECLARE(msg);
|
||||||
#endif /* TCP_LISTEN_BACKLOG */
|
#endif /* TCP_LISTEN_BACKLOG */
|
||||||
@ -399,11 +398,10 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn)
|
|||||||
*new_conn = NULL;
|
*new_conn = NULL;
|
||||||
LWIP_ERROR("netconn_accept: invalid conn", (conn != NULL), return ERR_ARG;);
|
LWIP_ERROR("netconn_accept: invalid conn", (conn != NULL), return ERR_ARG;);
|
||||||
|
|
||||||
err = conn->last_err;
|
if (ERR_IS_FATAL(conn->last_err)) {
|
||||||
if (ERR_IS_FATAL(err)) {
|
|
||||||
/* don't recv on fatal errors: this might block the application task
|
/* don't recv on fatal errors: this might block the application task
|
||||||
waiting on acceptmbox forever! */
|
waiting on acceptmbox forever! */
|
||||||
return err;
|
return conn->last_err;
|
||||||
}
|
}
|
||||||
if (!sys_mbox_valid(&conn->acceptmbox)) {
|
if (!sys_mbox_valid(&conn->acceptmbox)) {
|
||||||
return ERR_CLSD;
|
return ERR_CLSD;
|
||||||
@ -479,7 +477,6 @@ netconn_recv_data(struct netconn *conn, void **new_buf)
|
|||||||
{
|
{
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
u16_t len;
|
u16_t len;
|
||||||
err_t err;
|
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
API_MSG_VAR_DECLARE(msg);
|
API_MSG_VAR_DECLARE(msg);
|
||||||
#if LWIP_MPU_COMPATIBLE
|
#if LWIP_MPU_COMPATIBLE
|
||||||
@ -503,13 +500,12 @@ netconn_recv_data(struct netconn *conn, void **new_buf)
|
|||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);
|
LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);
|
||||||
|
|
||||||
err = conn->last_err;
|
if (ERR_IS_FATAL(conn->last_err)) {
|
||||||
if (ERR_IS_FATAL(err)) {
|
|
||||||
/* don't recv on fatal errors: this might block the application task
|
/* don't recv on fatal errors: this might block the application task
|
||||||
waiting on recvmbox forever! */
|
waiting on recvmbox forever! */
|
||||||
/* @todo: this does not allow us to fetch data that has been put into recvmbox
|
/* @todo: this does not allow us to fetch data that has been put into recvmbox
|
||||||
before the fatal error occurred - is that a problem? */
|
before the fatal error occurred - is that a problem? */
|
||||||
return err;
|
return conn->last_err;
|
||||||
}
|
}
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
#if (LWIP_UDP || LWIP_RAW)
|
#if (LWIP_UDP || LWIP_RAW)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user