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 |
|
|
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); |
507 |
} |
} |
508 |
|
|
509 |
error: |
error: |
|
alarm(0); |
|
510 |
if(socket) socket_free(&socket); |
if(socket) socket_free(&socket); |
511 |
|
|
512 |
return rv; |
return rv; |
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 |