* sockets.c (lwip_accept): Return EWOULDBLOCK if would block on non-blocking

socket.
This commit is contained in:
jifl 2008-10-02 13:59:18 +00:00
parent ba98bcdc60
commit 1d2804d6a2
2 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,10 @@ HISTORY
++ New features: ++ New features:
2008-10-02 Jonathan Larmour and Rishi Khan
* sockets.c (lwip_accept): Return EWOULDBLOCK if would block on non-blocking
socket.
2008-06-30 Simon Goldschmidt 2008-06-30 Simon Goldschmidt
* mem.c, opt.h, stats.h: fixed bug #21433: Calling mem_free/pbuf_free from * mem.c, opt.h, stats.h: fixed bug #21433: Calling mem_free/pbuf_free from
interrupt context isn't safe: LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT allows interrupt context isn't safe: LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT allows

View File

@ -258,6 +258,12 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
if (!sock) if (!sock)
return -1; return -1;
if ((sock->flags & O_NONBLOCK) && !sock->rcvevent) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): returning EWOULDBLOCK\n", s));
sock_set_errno(sock, EWOULDBLOCK);
return -1;
}
newconn = netconn_accept(sock->conn); newconn = netconn_accept(sock->conn);
if (!newconn) { if (!newconn) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) failed, err=%d\n", s, sock->conn->err)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) failed, err=%d\n", s, sock->conn->err));