tried to fix bug #23559: lwip_recvfrom problem with tcp

This commit is contained in:
goldsimon 2009-04-15 21:13:55 +00:00
parent 27b28a9306
commit 422ba5bcec
2 changed files with 13 additions and 0 deletions

View File

@ -83,6 +83,9 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2009-04-15 Simon Goldschmidt
* sockets.c: tried to fix bug #23559: lwip_recvfrom problem with tcp
2009-04-15 Simon Goldschmidt 2009-04-15 Simon Goldschmidt
* dhcp.c: task #9192: mem_free of dhcp->options_in and dhcp->msg_in * dhcp.c: task #9192: mem_free of dhcp->options_in and dhcp->msg_in

View File

@ -495,6 +495,11 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
} else { } else {
/* If this is non-blocking call, then check first */ /* If this is non-blocking call, then check first */
if (((flags & MSG_DONTWAIT) || (sock->flags & O_NONBLOCK)) && !sock->rcvevent) { if (((flags & MSG_DONTWAIT) || (sock->flags & O_NONBLOCK)) && !sock->rcvevent) {
if (off > 0) {
/* already received data, return that */
sock_set_errno(sock, 0);
return off;
}
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): returning EWOULDBLOCK\n", s)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): returning EWOULDBLOCK\n", s));
sock_set_errno(sock, EWOULDBLOCK); sock_set_errno(sock, EWOULDBLOCK);
return -1; return -1;
@ -506,6 +511,11 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: netconn_recv netbuf=%p\n", (void*)buf)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: netconn_recv netbuf=%p\n", (void*)buf));
if (!buf) { if (!buf) {
if (off > 0) {
/* already received data, return that */
sock_set_errno(sock, 0);
return off;
}
/* We should really do some error checking here. */ /* We should really do some error checking here. */
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL!\n", s)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL!\n", s));
sock_set_errno(sock, (((sock->conn->pcb.ip != NULL) && (sock->conn->err == ERR_OK)) sock_set_errno(sock, (((sock->conn->pcb.ip != NULL) && (sock->conn->err == ERR_OK))