about summary refs log tree commit homepage
path: root/lib/PublicInbox/DSPoll.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-25 20:54:34 +0000
committerEric Wong <e@80x24.org>2023-11-26 01:05:25 +0000
commit85f161be11a0c5561aa872fcadff3d08b8163ff6 (patch)
tree183a9a3783f0760931b05d300a1d64703d1c503a /lib/PublicInbox/DSPoll.pm
parentdb7e689902f7ea0b0f9188d14a28ce57fb9f221c (diff)
downloadpublic-inbox-85f161be11a0c5561aa872fcadff3d08b8163ff6.tar.gz
We can't assume signals are blocked when neither signalfd nor
EVFILT_SIGNAL are in use.  So just return an empty result so
the caller can recalculate the timeout.

I found this bug while making xt/httpd-async-stream.t
use our event loop to reap processes but have abandoned
that effort for now since it didn't save any code.
Diffstat (limited to 'lib/PublicInbox/DSPoll.pm')
-rw-r--r--lib/PublicInbox/DSPoll.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/DSPoll.pm b/lib/PublicInbox/DSPoll.pm
index b947f756..a7055ec9 100644
--- a/lib/PublicInbox/DSPoll.pm
+++ b/lib/PublicInbox/DSPoll.pm
@@ -26,11 +26,9 @@ sub ep_wait {
                 push(@pset, $fd, $pevents);
         }
         @$events = ();
-        do {
-                $n = IO::Poll::_poll($timeout_msec, @pset);
-        } while ($n < 0 && $! == Errno::EINTR);
+        $n = IO::Poll::_poll($timeout_msec, @pset) or return; # timeout expired
+        return if $n < 0 && $! == Errno::EINTR; # caller recalculates timeout
         die "poll: $!" if $n < 0;
-        return if $n == 0;
         while (defined($fd = shift @pset)) {
                 $revents = shift @pset or next; # no event
                 if ($revents & POLLNVAL) {