/[monit]/monit/validate.c
ViewVC logotype

Diff of /monit/validate.c

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

revision 1.56 by hauk, Fri Jul 25 15:04:46 2003 UTC revision 1.57 by hauk, Wed Jul 30 01:27:15 2003 UTC
# Line 61  Line 61 
61   */   */
62    
63    
 /* ------------------------------------------------------- Private variables */  
   
   
 static sigjmp_buf timeout;  
   
   
64  /* -------------------------------------------------------------- Prototypes */  /* -------------------------------------------------------------- Prototypes */
65    
66    
67  static int  check_skip(Service_T);  static int  check_skip(Service_T);
 static void connection_timeout(int);  
68  static int  compare_value(int, int, int);  static int  compare_value(int, int, int);
69  static void reset_resource_counter(Service_T);  static void reset_resource_counter(Service_T);
70    
# Line 479  static int check_process_connection(Serv Line 472  static int check_process_connection(Serv
472    volatile int rv= TRUE;    volatile int rv= TRUE;
473    
474    ASSERT(s && p);    ASSERT(s && p);
     
   /* Control comes here if a timeout occures */  
   if(sigsetjmp(timeout, TRUE)) {  
     snprintf(report, STRLEN, "timed out when testing %s [%s]",  
              p->address, p->protocol->name);  
     rv= FALSE;  
     goto error;  
       
   }  
   
   /* Set a timeout handler and activate the timer */  
   set_alarm_handler(connection_timeout);  
   alarm(CHECK_TIMEOUT);  
475    
476    /* Open a socket to the destination INET[hostname:port] or UNIX[pathname] */    /* Open a socket to the destination INET[hostname:port] or UNIX[pathname] */
477    socket= socket_create(p);    socket= socket_create(p);
# Line 527  static int check_process_connection(Serv Line 507  static int check_process_connection(Serv
507    }    }
508    
509    error:    error:
   alarm(0);  
510    if(socket) socket_free(&socket);    if(socket) socket_free(&socket);
511        
512    return rv;    return rv;
# Line 957  static int check_device_resources(Servic Line 936  static int check_device_resources(Servic
936        
937  }  }
938    
   
 /**  
  * Signal handler for connection timeout  
  */  
 static void connection_timeout(int sig) {  
     
   siglongjmp(timeout, TRUE);  
     
 }  
   
939    
940  /**  /**
941   * Comparison of values. Returns TRUE if comparison matches, otherwise   * Comparison of values. Returns TRUE if comparison matches, otherwise

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

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