about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-14 13:16:09 +0000
committerEric Wong <e@80x24.org>2021-10-15 02:23:27 +0000
commitf912df6e26aac8c20b4fa56dd69bc09c88f5403d (patch)
tree7cd929f9b5f72d7b32057100184d97cf0e011cfc /lib/PublicInbox/LEI.pm
parente482a9fb713db1c14b52d6db05049842605764e2 (diff)
downloadpublic-inbox-f912df6e26aac8c20b4fa56dd69bc09c88f5403d.tar.gz
The redispatch mechanism wasn't routing signals and messages
between redispatched workers and script/lei properly.  We now
rely on PktOp to do bidirectional message forwarding and
carefully avoiding circular references by using PktOp.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index d0905562..b6338377 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -573,6 +573,7 @@ sub _lei_atfork_child {
                 POSIX::setpgid(0, $$) // die "setpgid(0, $$): $!";
         }
         close($_) for (grep(defined, delete @$self{qw(3 old_1 au_done)}));
+        delete $self->{-socks};
         if (my $op_c = delete $self->{pkt_op_c}) {
                 close(delete $op_c->{sock});
         }
@@ -1144,7 +1145,9 @@ sub event_step {
                 if ($buf eq '') {
                         _drop_wq($self); # EOF, client disconnected
                         dclose($self);
-                } elsif ($buf =~ /\A(?:STOP|CONT)\z/) {
+                        $buf = 'TERM';
+                }
+                if ($buf =~ /\A(?:STOP|CONT|TERM)\z/) {
                         my $sig = "-$buf";
                         for my $wq (grep(defined, @$self{@WQ_KEYS})) {
                                 $wq->wq_kill($sig) or $wq->wq_kill_old($sig);
@@ -1152,6 +1155,8 @@ sub event_step {
                 } else {
                         die "unrecognized client signal: $buf";
                 }
+                my $s = $self->{-socks} // []; # lei up --all
+                @$s = grep { send($_, $buf, MSG_EOR) } @$s;
         };
         if (my $err = $@) {
                 eval { $self->fail($err) };