diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-11-28 04:59:19 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-11-28 04:59:19 +0000 |
commit | a17f69699e9f5aef720914781cd9df56cb36cc13 (patch) | |
tree | d8d57dfa1e56e0700562811aae181616523d686c | |
parent | Added --connect-timeout option to control the timeout (diff) | |
download | openvpn-a17f69699e9f5aef720914781cd9df56cb36cc13.tar.xz |
Modified nonblocking connect code so that this works as it should:
./openvpn --dev tap --proto tcp-client --verb 4 --remote [Black-Hole-IP-Addr] --connect-retry-max 1 --remap-usr1 SIGTERM
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@826 e7ae566f-a301-0410-adde-c780ea21d3b5
-rw-r--r-- | socket.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -811,10 +811,9 @@ socket_connect (socket_descriptor_t *sd, while (true) { - const int status = openvpn_connect (*sd, remote, connect_timeout, signal_received); + int status; - if (connect_retry_max != 0 && retry++ >= connect_retry_max) - *signal_received = SIGUSR1; + status = openvpn_connect (*sd, remote, connect_timeout, signal_received); get_signal (signal_received); if (*signal_received) @@ -830,8 +829,20 @@ socket_connect (socket_descriptor_t *sd, strerror_ts (status, &gc)); openvpn_close_socket (*sd); + *sd = SOCKET_UNDEFINED; + + if (connect_retry_max > 0 && ++retry >= connect_retry_max) + { + *signal_received = SIGUSR1; + goto done; + } + openvpn_sleep (connect_retry_seconds); + get_signal (signal_received); + if (*signal_received) + goto done; + if (remote_list) { remote_list_next (remote_list); |