projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Got something basically working
[spider.git]
/
perl
/
Msg.pm
diff --git
a/perl/Msg.pm
b/perl/Msg.pm
index ea2747dc1f158de86ca15512eb8506814495ea0e..4bc31faddfcf92546427549c4a0f81d5e39f45c8 100644
(file)
--- a/
perl/Msg.pm
+++ b/
perl/Msg.pm
@@
-123,7
+123,9
@@
sub connect {
# 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';
@@
-225,6
+227,7
@@
sub disconnect
}
if (defined($sock)) {
}
if (defined($sock)) {
+ shutdown($sock->{fh}, 2);
$sock->destroy;
}
$sock->destroy;
}
@@
-242,14
+245,18
@@
sub _send_stuff
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';
if (isdbg('raw')) {
if (isdbg('raw')) {
- 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");
+ }
}
}
}
}
@@
-285,7
+292,7
@@
sub _err_will_block {
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;})
;
}
#-----------------------------------------------------------------
}
#-----------------------------------------------------------------