summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-04-17 17:17:18 +0200
committerYorhel <git@yorhel.nl>2012-04-17 17:17:18 +0200
commit51e3c106a15b4f87fb06304a683f90be1f322872 (patch)
tree07dacd919ca424f21d34fd40e70e88f798000da2
parentfcf3560277c474e1f8063a77f01ef7ce95469fc6 (diff)
link: Don't attempt to write more stuff after close
-rw-r--r--Tanja.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tanja.pm b/Tanja.pm
index a0873f8..fcd72ef 100644
--- a/Tanja.pm
+++ b/Tanja.pm
@@ -216,6 +216,7 @@ sub new {
lasttup => [],
fmti => undef,
fmto => undef,
+ closed => 0,
}, $own;
$s->{write_handle} ||= $s->{handle};
@@ -248,6 +249,7 @@ sub new {
sub _cleanup {
my $s = shift;
+ $s->{closed} = 1;
$s->{node}->_unregister($_) for (values %{$s->{pat}});
$s->{pat} = {};
delete $s->{node}{lnk}{$s};
@@ -271,6 +273,7 @@ sub close {
sub _write {
my $s = shift;
+ return if $s->{closed};
$s->{write_handle}->push_write($s->{fmto} => @_);
$s->{on_write} && $s->{on_write}->(@_);
}