BUGFIX : Possible linked list bug
This commit is contained in:
parent
30ae45ec2b
commit
d200099244
Binary file not shown.
Binary file not shown.
11
anet.c
11
anet.c
|
@ -282,18 +282,15 @@ static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *l
|
||||||
while(1) {
|
while(1) {
|
||||||
fd = accept(s,sa,len);
|
fd = accept(s,sa,len);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
#ifdef _WIN32
|
|
||||||
errno = WSAGetLastError();
|
|
||||||
#endif
|
|
||||||
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
} else if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
continue;
|
continue;
|
||||||
|
#else
|
||||||
|
errno = WSAGetLastError();
|
||||||
|
if (errno == WSAEWOULDBLOCK) {
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
anetSetError(err, "accept: %s", strerror(errno));
|
anetSetError(err, "accept: %s", strerror(errno));
|
||||||
return ANET_ERR;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
7
net_io.c
7
net_io.c
|
@ -178,7 +178,9 @@ void modesSendAllClients(int service, void *msg, int len) {
|
||||||
struct client *c = Modes.clients;
|
struct client *c = Modes.clients;
|
||||||
|
|
||||||
while (c) {
|
while (c) {
|
||||||
|
// Read next before servicing client incase the service routine deletes the client!
|
||||||
struct client *next = c->next;
|
struct client *next = c->next;
|
||||||
|
|
||||||
if (c->service == service) {
|
if (c->service == service) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int nwritten = write(c->fd, msg, len);
|
int nwritten = write(c->fd, msg, len);
|
||||||
|
@ -921,6 +923,9 @@ void modesReadFromClients(void) {
|
||||||
struct client *c = modesAcceptClients();
|
struct client *c = modesAcceptClients();
|
||||||
|
|
||||||
while (c) {
|
while (c) {
|
||||||
|
// Read next before servicing client incase the service routine deletes the client!
|
||||||
|
struct client *next = c->next;
|
||||||
|
|
||||||
if (c->service == Modes.ris) {
|
if (c->service == Modes.ris) {
|
||||||
modesReadFromClient(c,"\n",decodeHexMessage);
|
modesReadFromClient(c,"\n",decodeHexMessage);
|
||||||
} else if (c->service == Modes.bis) {
|
} else if (c->service == Modes.bis) {
|
||||||
|
@ -928,7 +933,7 @@ void modesReadFromClients(void) {
|
||||||
} else if (c->service == Modes.https) {
|
} else if (c->service == Modes.https) {
|
||||||
modesReadFromClient(c,"\r\n\r\n",handleHTTPRequest);
|
modesReadFromClient(c,"\r\n\r\n",handleHTTPRequest);
|
||||||
}
|
}
|
||||||
c = c->next;
|
c = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -101,7 +101,6 @@ _inline int gettimeofday(struct timeval *tv, struct timezone *tz) {
|
||||||
|
|
||||||
#define STDIN_FILENO 0
|
#define STDIN_FILENO 0
|
||||||
#define EINPROGRESS WSAEINPROGRESS
|
#define EINPROGRESS WSAEINPROGRESS
|
||||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue