/[monit]/monit/http/engine.c
ViewVC logotype

Diff of /monit/http/engine.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.40 by martinp, Thu Sep 18 06:19:53 2003 UTC revision 1.41 by martinp, Thu Sep 18 07:24:40 2003 UTC
# Line 78  Line 78 
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    
# Line 458  static int is_host_allow(char *name) { Line 450  static int is_host_allow(char *name) {
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    

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26