about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-20 06:30:14 +0000
committerEric Wong <e@80x24.org>2020-12-20 20:39:13 +0000
commitdf708a4f7c4d62ef685ccf9868c78ff2709c1f40 (patch)
tree5f4fbf1349f3fe74096cb3c3cdf7e7120e8f4ca0 /lib/PublicInbox/Daemon.pm
parentba958c1a44ca7e48a5790a2ecb2198636d6492db (diff)
downloadpublic-inbox-df708a4f7c4d62ef685ccf9868c78ff2709c1f40.tar.gz
IO::Handle::blocking will always return the initial value from
the F_GETFL op and it won't issue F_SETFL if a socket is already
non-blocking.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index d1a42fc3..eeac3bd2 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -367,14 +367,12 @@ sub inherit ($) {
         foreach my $fd (3..$end) {
                 my $s = IO::Handle->new_from_fd($fd, 'r');
                 if (my $k = sockname($s)) {
-                        if ($s->blocking) {
-                                $s->blocking(0);
-                                warn <<"";
+                        my $prev_was_blocking = $s->blocking(0);
+                        warn <<"" if $prev_was_blocking;
 Inherited socket (fd=$fd) is blocking, making it non-blocking.
 Set 'NonBlocking = true' in the systemd.service unit to avoid stalled
 processes when multiple service instances start.
 
-                        }
                         $listener_names->{$k} = $s;
                         push @rv, $s;
                 } else {