alloc_socket(): Check for LWIP_SOCKET_POLL when setting select-related variables

This commit is contained in:
Joan Lledó 2018-10-06 11:07:30 +02:00 committed by Simon Goldschmidt
parent bc25863d1b
commit 368128a647

View File

@ -522,14 +522,14 @@ alloc_socket(struct netconn *newconn, int accepted)
after having marked it as used. */ after having marked it as used. */
SYS_ARCH_UNPROTECT(lev); SYS_ARCH_UNPROTECT(lev);
sockets[i].lastdata.pbuf = NULL; sockets[i].lastdata.pbuf = NULL;
#if LWIP_SOCKET_SELECT #if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
LWIP_ASSERT("sockets[i].select_waiting == 0", sockets[i].select_waiting == 0); LWIP_ASSERT("sockets[i].select_waiting == 0", sockets[i].select_waiting == 0);
sockets[i].rcvevent = 0; sockets[i].rcvevent = 0;
/* TCP sendbuf is empty, but the socket is not yet writable until connected /* TCP sendbuf is empty, but the socket is not yet writable until connected
* (unless it has been created by accept()). */ * (unless it has been created by accept()). */
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1); sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
sockets[i].errevent = 0; sockets[i].errevent = 0;
#endif /* LWIP_SOCKET_SELECT */ #endif /* LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL */
return i + LWIP_SOCKET_OFFSET; return i + LWIP_SOCKET_OFFSET;
} }
SYS_ARCH_UNPROTECT(lev); SYS_ARCH_UNPROTECT(lev);