From: Dirk Koopman Date: Sun, 19 Apr 2020 20:28:28 +0000 (+0100) Subject: clean up Msg debugging further X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=65c97626719e49d6c8cc04669af4289dd00e8e94;p=spider.git clean up Msg debugging further Also make sure that a FORCE CLOSE situation (which may now never happen) goes directly to close it. --- diff --git a/perl/Msg.pm b/perl/Msg.pm index e2092a90..61974b96 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -253,17 +253,15 @@ sub disconnect { my $conn = shift; my $count = $conn->{disconnecting}++; + my $dbg = isdbg('connll'); + my ($pkg, $fn, $line) = caller if $dbg; + if ($count > 2) { - if (isdbg('connll')) { - my ($pkg, $fn, $line) = caller; - dbg((ref $conn) . "::disconnect on call $conn->{call} attempt $conn->{disconnecting} called from ${pkg}::${fn} line $line FORCING CLOSE "); - } + dbg((ref $conn) . "::disconnect on call $conn->{call} attempt $conn->{disconnecting} called from ${pkg}::${fn} line $line FORCING CLOSE ") if $dbg; _close_it($conn); + return; } - if (isdbg('connll')) { - my ($pkg, $fn, $line) = caller; - dbg((ref $conn) . "::disconnect on call $conn->{call} attempt $conn->{disconnecting} called from ${pkg}::${fn} line $line "); - } + dbg((ref $conn) . "::disconnect on call $conn->{call} attempt $conn->{disconnecting} called from ${pkg}::${fn} line $line ") if $dbg; return if $count; # remove this conn from the active queue @@ -290,20 +288,21 @@ sub disconnect # Mojo::IOLoop->delay ( sub { my $delay = shift; - dbg("before drain $call"); + dbg("before drain $call") if $dbg; $sock->on(drain => $delay->begin); 1; }, sub { my $delay = shift; + dbg("before _close_it $call") if $dbg; _close_it($conn); 1; } ); $conn->{delay}->wait; - + } else { - dbg((ref $conn) . " socket missing on $conn->{call}") if isdbg('connll'); + dbg((ref $conn) . " socket missing on $conn->{call}") if $dbg; _close_it($conn); } }