summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-04-20 15:45:21 +0200
committerYorhel <git@yorhel.nl>2012-04-20 15:45:21 +0200
commit79a19c12da1869a0cafd323a4231261e75a827a2 (patch)
treecb2ed167bba4637cfde1486abb4ca99e1614dad3
parent51e3c106a15b4f87fb06304a683f90be1f322872 (diff)
link: Postpone close() handling + don't push_shutdown() the read handlerHEADmaster
The postpone of close() is necessary to allow stuff like $ses->send(..); $link->close(); Since a ->send() uses postpone to queue the messages.
-rw-r--r--Tanja.pm8
1 files 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;
+ };
}