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) {
|
||||
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;
|
||||
|
|
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue