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).
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);
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);