Commit 44ad0041 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Be more forgiving of failed syswrite/sysread to the TIP socket during

the connection handshake. If the capture is active, it is going to
write status and close the socket on its end, which may or may not be
propogated back to the client side before/after/during the
sysread/syswrite. I guess that a miserable way of saying there is a
lot of asynchrony involved.
parent 4b8a2889
......@@ -178,17 +178,24 @@ sub tipconnect($) {
# While its a fatal error if the connect fails, the write and the
# read that follows might fail because the tip is currently is
# active. The handshake writes back a value and then immediately
# closes the socket, which could manifest itself as a closed
# connection on this end, even before we get a change to do these.
# operations. In that case, just go around the loop again. We hope
# to succeed at some point.
if (! syswrite(TIP, $secretkey)) {
print STDERR
"*** Cannot write to $controller on $server($portnum)\n";
return 0;
goto again;
if (! sysread(TIP, $capret, length($capret))) {
print STDERR
"*** Cannot read from $controller on $server($portnum)\n";
return 0;
goto again;
my $foo = unpack("i", $capret);
......@@ -198,12 +205,15 @@ sub tipconnect($) {
if ($foo == 0) {
if ($i > 5) {
if ($i && (($i % 5) == 0)) {
printf STDERR
"*** WARNING: $controller on $server($portnum) is busy\n".
" Waiting a bit before trying again.\n";
" Waiting a bit before trying again. Pass $i.\n";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment