Skip to content

Commit

Permalink
More AnyEvent "Surprise! You're screwed!" workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
sanko committed Aug 27, 2010
1 parent 2a652fb commit e1d0694
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/Net/BitTorrent/Protocol/BEP03/Peer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@
ddx $p;
}
override 'disconnect' => sub {
super;
my $s = shift;
my ($s) = @_;
if (!$s->_handle->destroyed) {
$s->_handle->push_shutdown if defined $s->_handle->{'fh'};
$s->_handle->push_shutdown;
$s->_handle->destroy;
}
super;
};

# Outgoing packets
Expand Down
6 changes: 5 additions & 1 deletion lib/Net/BitTorrent/Protocol/BEP03/Peer/Outgoing.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@
return if !defined $s;
$s->_send_handshake;
},
on_read => sub {
on_eof => sub {
return if !defined $s;
$s->_handle->push_shutdown;
$s->_handle->destroy;
},
on_read => sub {
require Net::BitTorrent::Protocol::BEP03::Packets;
PACKET:
while (
Expand Down

0 comments on commit e1d0694

Please sign in to comment.