mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 09:19:53 +00:00
Avoid to lost previous error codes in sockets.c and api_lib.c.
This commit is contained in:
parent
8c847a85ae
commit
95f2d48ac4
@ -424,6 +424,7 @@ netconn_recv(struct netconn *conn)
|
||||
|
||||
#if LWIP_SO_RCVTIMEO
|
||||
if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&p, conn->recv_timeout)==SYS_ARCH_TIMEOUT) {
|
||||
conn->err = ERR_TIMEOUT;
|
||||
p = NULL;
|
||||
}
|
||||
#else
|
||||
@ -444,7 +445,10 @@ netconn_recv(struct netconn *conn)
|
||||
/* If we are closed, we indicate that we no longer wish to use the socket */
|
||||
if (p == NULL) {
|
||||
memp_free(MEMP_NETBUF, buf);
|
||||
conn->err = ERR_CLSD;
|
||||
/* Avoid to lost any previous error code */
|
||||
if (conn->err == ERR_OK) {
|
||||
conn->err = ERR_CLSD;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
|
||||
if (!buf) {
|
||||
/* We should really do some error checking here. */
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL!\n", s));
|
||||
sock_set_errno(sock, (sock->conn->type==NETCONN_UDP)?ETIMEDOUT:0);
|
||||
sock_set_errno(sock, (((sock->conn->pcb.ip!=NULL) && (sock->conn->err==ERR_OK))?ETIMEDOUT:err_to_errno(sock->conn->err)));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user