diff --git a/Release/dump1090.exe b/Release/dump1090.exe index bb8a2a1..f7a9cd1 100644 Binary files a/Release/dump1090.exe and b/Release/dump1090.exe differ diff --git a/Release/view1090.exe b/Release/view1090.exe index 21a927e..b6aacff 100644 Binary files a/Release/view1090.exe and b/Release/view1090.exe differ diff --git a/anet.c b/anet.c index 7552500..cbd7c6c 100644 --- a/anet.c +++ b/anet.c @@ -282,18 +282,15 @@ static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *l while(1) { fd = accept(s,sa,len); if (fd == -1) { -#ifdef _WIN32 - errno = WSAGetLastError(); -#endif - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { - #ifndef _WIN32 - } else if (errno == EINTR) { + if (errno == EINTR) { continue; +#else + errno = WSAGetLastError(); + if (errno == WSAEWOULDBLOCK) { #endif } else { anetSetError(err, "accept: %s", strerror(errno)); - return ANET_ERR; } } break; diff --git a/net_io.c b/net_io.c index add5956..98ce394 100644 --- a/net_io.c +++ b/net_io.c @@ -178,7 +178,9 @@ void modesSendAllClients(int service, void *msg, int len) { struct client *c = Modes.clients; while (c) { + // Read next before servicing client incase the service routine deletes the client! struct client *next = c->next; + if (c->service == service) { #ifndef _WIN32 int nwritten = write(c->fd, msg, len); @@ -921,6 +923,9 @@ void modesReadFromClients(void) { struct client *c = modesAcceptClients(); while (c) { + // Read next before servicing client incase the service routine deletes the client! + struct client *next = c->next; + if (c->service == Modes.ris) { modesReadFromClient(c,"\n",decodeHexMessage); } else if (c->service == Modes.bis) { @@ -928,7 +933,7 @@ void modesReadFromClients(void) { } else if (c->service == Modes.https) { modesReadFromClient(c,"\r\n\r\n",handleHTTPRequest); } - c = c->next; + c = next; } } // diff --git a/winstubs.h b/winstubs.h index f416668..5a6d575 100644 --- a/winstubs.h +++ b/winstubs.h @@ -101,7 +101,6 @@ _inline int gettimeofday(struct timeval *tv, struct timezone *tz) { #define STDIN_FILENO 0 #define EINPROGRESS WSAEINPROGRESS -#define EWOULDBLOCK WSAEWOULDBLOCK #ifdef __cplusplus }