]> dxcluster.org Git - spider.git/commitdiff
Remove wait on drain (which may never happen)
authorDirk Koopman <djk@tobit.co.uk>
Tue, 21 Apr 2020 18:43:32 +0000 (19:43 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 21 Apr 2020 18:43:32 +0000 (19:43 +0100)
Changed the arrangements sending logout files (what a palaver for
something so "simple"). Basically, if there is nothing to send on
disconnect, the Mojo "drain" signal is never emitted. So it hangs for
ever. But only sometimes (for some reason).

cmd/bye.pl
perl/Msg.pm

index 9288d44264402db471db2c00af3d55c6841c0498..c974799ea9d1034ef41863de6f2cde27cda42ced 100644 (file)
@@ -6,15 +6,16 @@
 
 
 my $self = shift;
-return (1, $self->msg('e5')) if $self->inscript;
+return (1, $self->msg('e5')) if $self->inscript || $self->remotecmd;
 
 my $fn = localdata("logout");
 dbg("fn: $fn " . (-e $fn ? 'exists' : 'missing'));
 
 if ($self->is_user && -e $fn) {
        $self->send_file($fn);
+       Mojo::IOLoop->timer($Msg::disc_waittime, sub{$self->disconnect});
+} else {
+       $self->disconnect;
 }
 
-$self->disconnect;
-
 return (1);
index f3642d59b79dfabd3bbe0b7f00e7d514421981ba..aa9993e7ff966bf2b15ae5d3dc9782e96a421271 100644 (file)
@@ -283,24 +283,7 @@ sub disconnect
                        my $ref = $conns{$call};
                        delete $conns{$call} if $ref && $ref == $conn;
                }
-
-               $conn->{delay} = Mojo::IOLoop->delay (
-#                               Mojo::IOLoop->delay (
-                                                                                         sub {
-                                                                                                 my $delay = shift;
-                                                                                                 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;
-
+               _close_it($conn);
        } else {
                dbg((ref $conn) . " socket missing on $conn->{call}") if $dbg;
                _close_it($conn);