58 |
#include <unistd.h> |
#include <unistd.h> |
59 |
#endif |
#endif |
60 |
|
|
61 |
|
#ifdef HAVE_FCNTL_H |
62 |
|
#include <fcntl.h> |
63 |
|
#endif |
64 |
|
|
65 |
#ifdef HAVE_STRING_H |
#ifdef HAVE_STRING_H |
66 |
#include <string.h> |
#include <string.h> |
67 |
#endif |
#endif |
472 |
|
|
473 |
if( (rv= poll(fds, 1, 1000)) > 0) { |
if( (rv= poll(fds, 1, 1000)) > 0) { |
474 |
|
|
475 |
|
pthread_mutex_lock(&Run.mutex_fd); |
476 |
|
|
477 |
if( (client= accept(server, (struct sockaddr*)&in, &len)) < 0) { |
if( (client= accept(server, (struct sockaddr*)&in, &len)) < 0) { |
478 |
|
|
479 |
|
pthread_mutex_unlock(&Run.mutex_fd); |
480 |
|
|
481 |
if(stopped) { |
if(stopped) { |
482 |
log("http server: service stopped\n"); |
log("http server: service stopped\n"); |
483 |
} else if(errno == EINTR) { |
} else if(errno == EINTR) { |
490 |
|
|
491 |
} |
} |
492 |
|
|
493 |
|
if(fcntl(client, F_SETFD, fcntl(client, F_GETFD) | FD_CLOEXEC) == -1) { |
494 |
|
close(client); |
495 |
|
pthread_mutex_unlock(&Run.mutex_fd); |
496 |
|
return NULL; |
497 |
|
} |
498 |
|
|
499 |
|
pthread_mutex_unlock(&Run.mutex_fd); |
500 |
|
|
501 |
} else { |
} else { |
502 |
|
|
503 |
if(rv < 0) |
if(rv < 0) |