]> dxcluster.net Git - spider.git/commitdiff
clean up Msg debugging further
authorDirk Koopman <djk@tobit.co.uk>
Sun, 19 Apr 2020 20:28:28 +0000 (21:28 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sun, 19 Apr 2020 20:28:28 +0000 (21:28 +0100)
Also make sure that a FORCE CLOSE situation (which may now never happen)
goes directly to close it.

perl/Msg.pm

index e2092a90eeb941b06ce35a2c32f01382370a46ae..61974b962160173f02e671c7986fe1ab6dbf148c 100644 (file)
@@ -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);
        }
 }