projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reset retryattempts when successfully reestablishing tunnel
[clearscm.git]
/
bin
/
tunnel.pl
diff --git
a/bin/tunnel.pl
b/bin/tunnel.pl
index
2ee85f0
..
56be859
100755
(executable)
--- a/
bin/tunnel.pl
+++ b/
bin/tunnel.pl
@@
-124,6
+124,8
@@
sub interrupt {
Report "Tunnel killed unexpectedly", 1;
kill 'INT', $ssh->get_master_pid;
Report "Tunnel killed unexpectedly", 1;
kill 'INT', $ssh->get_master_pid;
+
+ return;
} # interrupt
sub tunnel() {
} # interrupt
sub tunnel() {
@@
-142,6
+144,7
@@
RETRY:
Report("Unable to establish ssh tunnel " . $ssh->error, 1) if $ssh->error;
Report("Unable to establish ssh tunnel " . $ssh->error, 1) if $ssh->error;
+ # Check to see if address is already in use
my @lines = <$fh>;
close $fh;
my @lines = <$fh>;
close $fh;
@@
-158,6
+161,9
@@
RETRY:
$log->msg($msg);
$log->msg($msg);
+ # Reset retry attempts since we reestablished the tunnel
+ $retryattempts = 0 if $retryattempts;
+
# Wait for master to exit
waitpid($ssh->get_master_pid, WUNTRACED);
# Wait for master to exit
waitpid($ssh->get_master_pid, WUNTRACED);
@@
-168,6
+174,8
@@
RETRY:
Report 'Ssh tunnel terminated unexpectedly - Attempting restart';
Report 'Ssh tunnel terminated unexpectedly - Attempting restart';
+ undef $ssh;
+
goto RETRY;
} # if
goto RETRY;
} # if