/[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.35 by martinp, Wed Sep 17 18:00:52 2003 UTC revision 1.36 by hauk, Wed Sep 17 18:07:26 2003 UTC
# Line 459  static int is_host_allow(char *name) { Line 459  static int is_host_allow(char *name) {
459   */   */
460  static RequestWrapper socket_producer(int server) {  static RequestWrapper socket_producer(int server) {
461    
462      int i= 0;
463    int client, rv;    int client, rv;
   int len= sizeof(struct sockaddr_in);  
464    struct sockaddr_in in;    struct sockaddr_in in;
465    struct pollfd fds[1];    struct pollfd fds[1];
466      int len= sizeof(struct sockaddr_in);
467    
468    fds[0].fd = server;    fds[0].fd= server;
469    fds[0].events = POLLIN | POLLPRI;    fds[0].events= POLLIN | POLLPRI;
470    
   again:  
471    errno= 0;    errno= 0;
472      do {
473        i= poll(fds, 1, 1000);
474        rv= (i == 1 && fds[0].revents & (POLLIN));
475      } while(i == -1 && errno == EINTR);
476    
477    if( (rv= poll(fds, 1, 1000)) > 0) {    if(rv > 0) {
478    
479      pthread_mutex_lock(&Run.mutex_fd);      pthread_mutex_lock(&Run.mutex_fd);
480    
# Line 480  static RequestWrapper socket_producer(in Line 484  static RequestWrapper socket_producer(in
484    
485        if(stopped) {        if(stopped) {
486          log("http server: service stopped\n");          log("http server: service stopped\n");
487        } else if(errno == EINTR) {        }  else {
         goto again;  
       } else {  
488          log("http server: cannot accept connection -- %s\n", STRERROR);          log("http server: cannot accept connection -- %s\n", STRERROR);
489        }        }
490    
# Line 500  static RequestWrapper socket_producer(in Line 502  static RequestWrapper socket_producer(in
502    
503    } else {    } else {
504    
     if(rv < 0)  
       log("http server: cannot poll server socket -- %s\n", STRERROR);  
   
505      /* in the case that timeout or error occured, return NULL to allow      /* in the case that timeout or error occured, return NULL to allow
506       * the caller handle various states (such as stopped) which can       * the caller handle various states (such as stopped) which can
507       * occure in the meantime */       * occure in the meantime */

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

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