user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/4] daemon: drop listener sockets ASAP on termination
  2016-03-05  6:07  5% [PATCH 0/4] daemon-related cleanups Eric Wong
@ 2016-03-05  6:07  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-03-05  6:07 UTC (permalink / raw)
  To: meta

We do not want to be accepting connections during graceful
shutdown because another new process is likely taking over.
This also allows us to free up the listener case another
(independent) process wants to claim it.
---
 lib/PublicInbox/Daemon.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index f0be034..c3199cd 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -137,6 +137,7 @@ sub worker_quit () {
 	# killing again terminates immediately:
 	exit unless @listeners;
 
+	$_->close foreach @listeners; # call Danga::Socket::close
 	@listeners = ();
 
 	# give slow clients 30s to finish reading/writing whatever
@@ -401,7 +402,9 @@ sub daemon_loop ($$) {
 	$SIG{USR1} = *reopen_logs;
 	$SIG{HUP} = $refresh;
 	# this calls epoll_create:
-	PublicInbox::Listener->new($_, $post_accept) for @listeners;
+	@listeners = map {
+		PublicInbox::Listener->new($_, $post_accept)
+	} @listeners;
 	Danga::Socket->EventLoop;
 	$parent_pipe = undef;
 }
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] daemon-related cleanups
@ 2016-03-05  6:07  5% Eric Wong
  2016-03-05  6:07  7% ` [PATCH 2/4] daemon: drop listener sockets ASAP on termination Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-03-05  6:07 UTC (permalink / raw)
  To: meta

Nothing earth-shattering, but we need to start documenting
this for users if we expect people to start using it :p.

Eric Wong (4):
      t/httpd-corner: additional callback test
      daemon: drop listener sockets ASAP on termination
      daemon: avoid cyclic references for once-used callbacks
      daemon: simplify parent death handling

 lib/PublicInbox/Daemon.pm | 9 +++++++--
 t/httpd-corner.psgi       | 9 +++++++++
 t/httpd-corner.t          | 9 +++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-03-05  6:07  5% [PATCH 0/4] daemon-related cleanups Eric Wong
2016-03-05  6:07  7% ` [PATCH 2/4] daemon: drop listener sockets ASAP on termination Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).