retval = select(highest + 1, &readfds, NULL, NULL, &tv);
}
else {
+ --num_workers;
return NULL;
}
#if 0
syslog(LOG_DEBUG, "Interrupted select()\n");
#endif
- if (server_shutting_down) return(NULL);
+ if (server_shutting_down) {
+ --num_workers;
+ return(NULL);
+ }
goto do_select;
}
}
else if (retval == 0) {
- if (server_shutting_down) return(NULL);
+ if (server_shutting_down) {
+ --num_workers;
+ return(NULL);
+ }
}
/* It must be a client socket. Find a context that has data
tv.tv_usec = 0;
retval = select(highest + 1, &master_fds, NULL, NULL, &tv);
}
- else
- return NULL;
+ else {
+ retval = -1 ;
+ }
/* Now figure out who made this select() unblock.
* First, check for an error or exit condition.
continue;
}
}
- else if(retval == 0) {
- if (server_shutting_down) return(NULL);
- continue;
- }
+
/* Next, check to see if it's a new client connecting
* on a master socket.
*/
- else for (serviceptr = ServiceHookTable; serviceptr != NULL;
- serviceptr = serviceptr->next ) {
+ else if ((retval > 0) && (!server_shutting_down)) for (serviceptr = ServiceHookTable; serviceptr != NULL; serviceptr = serviceptr->next) {
if (FD_ISSET(serviceptr->msock, &master_fds)) {
ssock = accept(serviceptr->msock, NULL, 0);
}
}
}
- CtdlClearSystemContext();
-
return NULL;
}