Need to sort out shutdown and related things
my @in = <I>;
close(I);
$self->send_now('D', @in);
my @in = <I>;
close(I);
$self->send_now('D', @in);
}
#$self->send_now('Z', "");
}
#$self->send_now('Z', "");
# chomp;
my @lines = split /\n/;
for (@lines) {
# 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
$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');
# chomp;
my @lines = split /\n/;
for (@lines) {
# 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
$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');
for (ref $l ? @$l : $l) {
my @lines = split /\n/;
for (@lines) {
for (ref $l ? @$l : $l) {
my @lines = split /\n/;
for (@lines) {
- $conn->send_later("D$call|$_");
dbg("-> D $call $_") if isdbg('chan');
dbg("-> D $call $_") if isdbg('chan');
+ $conn->send_later("D$call|$_");
my $user = $self->{user};
$user->close() if defined $user;
my $user = $self->{user};
$user->close() if defined $user;
- $self->{conn}->disconnect if $self->{conn};
+ $self->{conn}->close_on_empty if $self->{conn};
# Create a connection end-point object
my $conn = $pkg;
# 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';
$conn->{peerhost} = $to_host;
$conn->{peerport} = $to_port;
$conn->{sort} = 'Outgoing';
+ shutdown($sock->{fh}, 2);
while (@$rq) {
my $data = shift @$rq;
my $lth = length $data;
while (@$rq) {
my $data = shift @$rq;
my $lth = length $data;
+ my $call = $conn->{call} || 'none';
- my $call = $conn->{call} || 'none';
if (isdbg('raw')) {
dbgdump('raw', "$call send $lth: ", $lth);
}
}
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;
sub close_on_empty
{
my $conn = shift;
- $conn->{sock}->push_shutdown;
+ $conn->{sock}->on_drain(sub {$conn->disconnect;});
}
#-----------------------------------------------------------------
}
#-----------------------------------------------------------------
$version = '1.56';
$subversion = '0';
$version = '1.56';
$subversion = '0';
-$build = '1';
-$gitversion = 'd17f05b';
+$build = '2';
+$gitversion = '38aa5af';