about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-27 22:12:48 +0000
committerEric Wong <e@80x24.org>2020-09-28 05:48:14 +0000
commit8ba04f214bbadcbe106c94281a0c4c21dd50adb8 (patch)
treea225cd4a836ead39d6b1f2dc4a72f81409684db6 /lib/PublicInbox/Daemon.pm
parent28dec3a76687617a3a697058964dc0bd1351eb6b (diff)
downloadpublic-inbox-8ba04f214bbadcbe106c94281a0c4c21dd50adb8.tar.gz
gcf2: improve error handling and do not ->fail on wbuf
For historical reasons, both Danga::Socket::write and
PublicInbox::DS::write will return 0 when data is buffered;
so Gcf2Client must not call ->fail when DS::write returns 0.

We'll also improve robustness by recreating the entire
Gcf2Client object if it does die for other reasons, instead of
risking mismatched fields due to deferred close.

We also need to ensure we only get one EPOLLERR wakeup and
issue EPOLL_CTL_DEL if ->event_step is triggered by a dying
Gcf2 process, so always register the FD with EPOLLONESHOT.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 1520f8f2..155707e1 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -654,14 +654,8 @@ sub run ($$$;$) {
         my $af_default = $default =~ /:8080\z/ ? 'httpready' : undef;
         my $for_destroy = daemonize();
 
-        # this wastes a bit of memory for non-PublicInbox::WWW -httpd users
-        # oh well...
-        eval {
-                require PublicInbox::Gcf2;
-                require PublicInbox::Gcf2Client;
-        };
-        local $PublicInbox::GitAsyncCat::GCF2C =
-                                PublicInbox::Gcf2Client::new() if !$@;
+        # localize GCF2C for tests:
+        local $PublicInbox::GitAsyncCat::GCF2C;
 
         daemon_loop($refresh, $post_accept, $tlsd, $af_default);
         PublicInbox::DS->Reset;