about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-31 20:42:53 +0000
committerEric Wong <e@80x24.org>2023-11-01 07:08:10 +0000
commiteb0499105e263a67d54692425471197dabfadbeb (patch)
tree1d7776852c9f3b5f404344705cdccfafcb6c8c54 /lib/PublicInbox
parentfdf90c0ffbf608ed08665eaffa5c750fa5a5bfee (diff)
downloadpublic-inbox-eb0499105e263a67d54692425471197dabfadbeb.tar.gz
There's no need to waste time nor reach into DS internals to
map FDs to Perl objects, here.  LEI.pm has never had to deal
with integer FDs for DirIdle, either.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/Watch.pm11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 41b77dc1..c2b1312a 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -256,9 +256,8 @@ sub quit { # may be called in IMAP/NNTP children
         %{$self->{opendirs}} = ();
         _done_for_now($self);
         quit_done($self);
-        if (defined(my $fd = delete $self->{dir_idle_fd})) {
-                my $di = $PublicInbox::DS::DescriptorMap{$fd};
-                $di->close if $di && $di->can('add_watches');
+        if (my $dir_idle = delete $self->{dir_idle}) {
+                $dir_idle->close if $dir_idle;
         }
         if (my $idle_mic = delete $self->{idle_mic}) { # IMAP child
                 return unless $idle_mic->IsConnected && $idle_mic->Socket;
@@ -283,8 +282,7 @@ sub watch_fs_init ($) {
         };
         require PublicInbox::DirIdle;
         # inotify_create + EPOLL_CTL_ADD
-        my $dir_idle = PublicInbox::DirIdle->new($cb);
-        $self->{dir_idle_fd} = fileno($dir_idle->{sock}) if $dir_idle->{sock};
+        my $dir_idle = $self->{dir_idle} = PublicInbox::DirIdle->new($cb);
         $dir_idle->add_watches([keys %{$self->{mdmap}}]);
 }
 
@@ -383,8 +381,7 @@ sub watch_imap_idle_1 ($$$) {
 
 sub watch_atfork_child ($) {
         my ($self) = @_;
-        delete $self->{pids};
-        delete $self->{opendirs};
+        delete @$self{qw(dir_idle pids opendirs)};
         my $sig = delete $self->{sig};
         $sig->{CHLD} = $sig->{HUP} = $sig->{USR1} = 'DEFAULT';
         # TERM/QUIT/INT call ->quit, which works in both parent+child