78 |
#include <arpa/inet.h> |
#include <arpa/inet.h> |
79 |
#endif |
#endif |
80 |
|
|
|
#ifdef HAVE_POLL_H |
|
|
#include <poll.h> |
|
|
#endif |
|
|
|
|
|
#ifdef HAVE_SYS_POLL_H |
|
|
#include <sys/poll.h> |
|
|
#endif |
|
|
|
|
81 |
#include "http_utils.h" |
#include "http_utils.h" |
82 |
#include "engine.h" |
#include "engine.h" |
83 |
|
|
450 |
*/ |
*/ |
451 |
static RequestWrapper socket_producer(int server) { |
static RequestWrapper socket_producer(int server) { |
452 |
|
|
|
int i= 0; |
|
453 |
int client, rv; |
int client, rv; |
454 |
|
fd_set rset; |
455 |
|
struct timeval tv; |
456 |
struct sockaddr_in in; |
struct sockaddr_in in; |
|
struct pollfd fds[1]; |
|
457 |
int len= sizeof(struct sockaddr_in); |
int len= sizeof(struct sockaddr_in); |
458 |
|
|
459 |
fds[0].fd= server; |
FD_ZERO(&rset); |
460 |
fds[0].events= POLLIN; |
FD_SET(server, &rset); |
461 |
|
|
|
errno= 0; |
|
462 |
do { |
do { |
463 |
i= poll(fds, 1, 1000); |
errno= 0; |
464 |
rv= (i == 1 && fds[0].revents & (POLLIN)); |
tv.tv_sec= 1; |
465 |
} while(i == -1 && errno == EINTR); |
tv.tv_usec= 0; |
466 |
|
|
467 |
|
rv= select(server+1, &rset, NULL, NULL, &tv); |
468 |
|
} while(rv == -1 && errno == EINTR); |
469 |
|
|
470 |
if(rv > 0) { |
if(rv > 0) { |
471 |
|
|