diff options
-rw-r--r-- | qarsh.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -56,6 +56,7 @@ hbeat_t qarsh_hb; /* Heartbeat handle */ int signal_to_send = 0; int sigs_to_propogate[] = { SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2 }; sigset_t pselect_sigmask; +int connection_timeout = 0; void usage() @@ -107,8 +108,7 @@ sig_handler(int sig) void sig_alrm_handler(int sig) { - fprintf(stderr, "Could not connect to remote host\n"); - exit(127); + connection_timeout = 1; } void @@ -517,6 +517,10 @@ again: alarm(CONNECT_TIMEOUT); qarsh_fd = connect_to_host(host, port, &qarsh_ss_family); alarm(0); + if (connection_timeout) { + fprintf(stderr, "Could not connect to remote host\n"); + exit(127); + } if (qarsh_fd == -1) { if (errno == 0) { |