From 65c97626719e49d6c8cc04669af4289dd00e8e94 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Sun, 19 Apr 2020 21:28:28 +0100 Subject: [PATCH] clean up Msg debugging further Also make sure that a FORCE CLOSE situation (which may now never happen) goes directly to close it. --- perl/Msg.pm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) 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); } } -- 2.34.1