]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Daemon.pm
Merge branch 'thread-view-skel'
[public-inbox.git] / lib / PublicInbox / Daemon.pm
index b64ec87412dc07703d2a171c34ce59fb3511a2e3..512bb2083c5c65f84f9627c455780c19b7abc62b 100644 (file)
@@ -180,7 +180,8 @@ sub worker_quit {
                my $n = 0;
 
                foreach my $s (values %$dmap) {
-                       if ($s->can('busy') && $s->busy) {
+                       $s->can('busy') or next;
+                       if ($s->busy) {
                                ++$n;
                        } else {
                                # close as much as possible, early as possible
@@ -375,12 +376,12 @@ sub master_loop {
                                exit if $quit++;
                                kill_workers($s);
                        } elsif ($s eq 'WINCH') {
-                               if (-t STDIN || -t STDOUT || -t STDERR) {
+                               if ($daemonize) {
+                                       $worker_processes = 0;
+                               } else {
                                        warn
-"ignoring SIGWINCH while connected to terminal\n";
+"ignoring SIGWINCH since we are not daemonized\n";
                                        $SIG{WINCH} = 'IGNORE';
-                               } else {
-                                       $worker_processes = 0;
                                }
                        } elsif ($s eq 'HUP') {
                                $worker_processes = $set_workers;
@@ -448,6 +449,7 @@ sub daemon_loop ($$) {
        $SIG{QUIT} = $SIG{INT} = $SIG{TERM} = *worker_quit;
        $SIG{USR1} = *reopen_logs;
        $SIG{HUP} = $refresh;
+       $SIG{$_} = 'DEFAULT' for qw(CHLD USR2 TTIN TTOU WINCH);
        # this calls epoll_create:
        @listeners = map {
                PublicInbox::Listener->new($_, $post_accept)