diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-02 03:12:23 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-02 09:06:08 +0000 |
commit | c062644c64bf44b48bd6469e1d4e77d8b9cfdc87 (patch) | |
tree | 68d4fd7e3578419bd5d3ccb20b9aae0bc5d92ad2 | |
parent | 6d448aae2a6624d37b291946b6666d5101c2957b (diff) | |
download | public-inbox-c062644c64bf44b48bd6469e1d4e77d8b9cfdc87.tar.gz |
We'll be using these in a more OO manner for V2Writable (which doesn't use Danga::Socket), so lets not unnecessarily register cleanup handlers intended for network daemons.
-rw-r--r-- | lib/PublicInbox/Daemon.pm | 1 | ||||
-rw-r--r-- | lib/PublicInbox/EvCleanup.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/Inbox.pm | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 0329bd34..9d27d2be 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -460,6 +460,7 @@ sub daemon_loop ($$) { @listeners = map { PublicInbox::Listener->new($_, $post_accept) } @listeners; + $PublicInbox::EvCleanup::ENABLED = 1; Danga::Socket->EventLoop; $parent_pipe = undef; } diff --git a/lib/PublicInbox/EvCleanup.pm b/lib/PublicInbox/EvCleanup.pm index 559730e9..8ed5180b 100644 --- a/lib/PublicInbox/EvCleanup.pm +++ b/lib/PublicInbox/EvCleanup.pm @@ -7,6 +7,8 @@ use strict; use warnings; use base qw(Danga::Socket); use fields qw(rd); + +our $ENABLED; my $singleton; my $asapq = [ [], undef ]; my $nextq = [ [], undef ]; diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 54a6eb32..b9cd4c40 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -29,6 +29,7 @@ sub cleanup_task () { sub _cleanup_later ($) { my ($self) = @_; + return unless $PublicInbox::EvCleanup::ENABLED; $cleanup_timer ||= PublicInbox::EvCleanup::later(*cleanup_task); $CLEANUP->{"$self"} = $self; } |