From: Matt S Trout Date: Tue, 6 Dec 2011 22:39:44 +0000 (+0000) Subject: rewrite ListenerService's DEMOLISH method for sanity and clarity X-Git-Tag: v0.001001~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=baea9bdae94b3880fdb1a1788ed54a7aec15e2ad;p=scpubgit%2FTak-Daemon.git rewrite ListenerService's DEMOLISH method for sanity and clarity --- diff --git a/lib/Tak/Daemon/ListenerService.pm b/lib/Tak/Daemon/ListenerService.pm index 95c0499..1751ab5 100644 --- a/lib/Tak/Daemon/ListenerService.pm +++ b/lib/Tak/Daemon/ListenerService.pm @@ -76,12 +76,15 @@ sub handle_stop { } sub DEMOLISH { - my ($self, $gd) = @_; - return if $gd; - if (my $l = $self->listener) { - $l->get_loop->remove($l); - unlink($self->socket_location); - } + my ($self, $in_global_destruction) = @_; + + return unless $self->state eq 'running'; + + unlink($self->socket_location); + + return if $in_global_destruction; + + Tak->loop->remove($self->listener); } sub setup_connection {