X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTak%2FDaemon%2FListenerService.pm;h=1751ab51cd60df62f7a375e9f8d543b11b287ef8;hb=baea9bdae94b3880fdb1a1788ed54a7aec15e2ad;hp=95c04990b81d5428e5e38abe4c6cbfbb35ee4fd9;hpb=6518a48007b56194d5f14d8f66762cabda795bca;p=scpubgit%2FTak-Daemon.git 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 {