From 79a19c12da1869a0cafd323a4231261e75a827a2 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 20 Apr 2012 15:45:21 +0200 Subject: link: Postpone close() handling + don't push_shutdown() the read handler The postpone of close() is necessary to allow stuff like $ses->send(..); $link->close(); Since a ->send() uses postpone to queue the messages. --- Tanja.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tanja.pm b/Tanja.pm index fcd72ef..ad9fd12 100644 --- a/Tanja.pm +++ b/Tanja.pm @@ -265,9 +265,11 @@ sub _err { sub close { - $_[0]->_cleanup; - $_[0]->{write_handle}->push_shutdown; - $_[0]->{read_handle}->push_shutdown; + my $s = shift; + AnyEvent::postpone { + $s->_cleanup; + $s->{write_handle}->push_shutdown; + }; } -- cgit v1.2.3