my @in = <I>;
close(I);
$self->send_now('D', @in);
- sleep(1);
+ Msg->sleep(1);
}
#$self->send_now('Z', "");
# chomp;
my @lines = split /\n/;
for (@lines) {
+ dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
$conn->send_now("$sort$call|$_");
# debug log it, but not if it is a log message
- dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
}
}
$self->{t} = time;
# chomp;
my @lines = split /\n/;
for (@lines) {
+ dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
$conn->send_later("$sort$call|$_");
# debug log it, but not if it is a log message
- dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
}
}
$self->{t} = time;
for (ref $l ? @$l : $l) {
my @lines = split /\n/;
for (@lines) {
- $conn->send_later("D$call|$_");
dbg("-> D $call $_") if isdbg('chan');
+ $conn->send_later("D$call|$_");
}
}
}
my $user = $self->{user};
$user->close() if defined $user;
- $self->{conn}->disconnect if $self->{conn};
+ $self->{conn}->close_on_empty if $self->{conn};
$self->del();
}
# Create a connection end-point object
my $conn = $pkg;
- $conn = $pkg->new($rproc);
+ unless (ref $pkg) {
+ $conn = $pkg->new($rproc);
+ }
$conn->{peerhost} = $to_host;
$conn->{peerport} = $to_port;
$conn->{sort} = 'Outgoing';
}
if (defined($sock)) {
+ shutdown($sock->{fh}, 2);
$sock->destroy;
}
while (@$rq) {
my $data = shift @$rq;
my $lth = length $data;
+ my $call = $conn->{call} || 'none';
if (isdbg('raw')) {
- my $call = $conn->{call} || 'none';
if (isdbg('raw')) {
dbgdump('raw', "$call send $lth: ", $lth);
}
}
- $sock->push_write($data);
- $total_out = $lth;
+ if (defined $sock && !$sock->destroyed) {
+ $sock->push_write($data);
+ $total_out = $lth;
+ } else {
+ dbg("_send_stuff $call ending data ignored: $data");
+ }
}
}
sub close_on_empty
{
my $conn = shift;
- $conn->{sock}->push_shutdown;
+ $conn->{sock}->on_drain(sub {$conn->disconnect;});
}
#-----------------------------------------------------------------
$version = '1.56';
$subversion = '0';
-$build = '1';
-$gitversion = 'd17f05b';
+$build = '2';
+$gitversion = '38aa5af';
1;