nsa_accept() needs a loop for blocking mode. It may be possible that incoming connects are already closed (and removed) -> continue waiting.
@@ -402,7 +402,7 @@ int nsa_accept(int sockfd, struct sockaddr* addr, socklen_t* addrlen)
if(neatSocket->ns_flags & NSAF_LISTENING) {
/* ====== Accept new socket ================================== */
struct neat_socket* newSocket = TAILQ_FIRST(&neatSocket->ns_accept_list);
- if( (newSocket == NULL) &&
+ while( (newSocket == NULL) &&
(!(neatSocket->ns_flags & NSAF_NONBLOCKING)) ) {
/* ====== Blocking mode: wait ============================= */
es_has_fired(&neatSocket->ns_read_signal); /* Clear read signal */
