From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/6] daemon: unconditionally call IO::Handle::blocking(0)
Date: Sun, 20 Dec 2020 06:30:14 +0000 [thread overview]
Message-ID: <20201220063016.20959-5-e@80x24.org> (raw)
In-Reply-To: <20201220063016.20959-1-e@80x24.org>
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.
---
lib/PublicInbox/Daemon.pm | 6 ++----
1 file 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 {
next prev parent reply other threads:[~2020-12-20 6:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-20 6:30 [PATCH 0/6] path usability and some tiny cleanups Eric Wong
2020-12-20 6:30 ` [PATCH 1/6] script/public-inbox-*: favor caller-provided pathnames Eric Wong
2020-12-20 6:30 ` [PATCH 2/6] inboxidle: remove needless check for {inboxdir} Eric Wong
2020-12-20 6:30 ` [PATCH 3/6] daemon: lazy load Cwd only for --daemonize users Eric Wong
2020-12-20 6:30 ` Eric Wong [this message]
2020-12-20 6:30 ` [PATCH 5/6] daemon: kill_workers: eliminate unnecessary loop Eric Wong
2020-12-20 6:30 ` [PATCH 6/6] config: eliminate unnecessary join call up front Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201220063016.20959-5-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).