]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiAuth.pm
lei: consolidate the bulk of the IPC code
[public-inbox.git] / lib / PublicInbox / LeiAuth.pm
index 6593ba515db4bfd82ecc7b65e82c65635b139c7a..7acb9900a3bdcf0c9c7947d8147f2cc276397b61 100644 (file)
@@ -43,24 +43,13 @@ sub auth_eof {
 sub auth_start {
        my ($self, $lei, $post_auth_cb, @args) = @_;
        $lei->_lei_cfg(1); # workers may need to read config
-       my $ops = {
-               '!' => [ $lei->can('fail_handler'), $lei ],
-               '|' => [ $lei->can('sigpipe_handler'), $lei ],
-               'x_it' => [ $lei->can('x_it'), $lei ],
-               'child_error' => [ $lei->can('child_error'), $lei ],
+       my $op = $lei->workers_start($self, 'auth', 1, {
                'nrd_merge' => [ \&nrd_merge, $lei ],
                '' => [ \&auth_eof, $lei, $post_auth_cb, @args ],
-       };
-       ($lei->{pkt_op_c}, $lei->{pkt_op_p}) = PublicInbox::PktOp->pair($ops);
-       $self->wq_workers_start('lei_auth', 1, $lei->oldset, {lei => $lei});
-       my $op = delete $lei->{pkt_op_c};
-       delete $lei->{pkt_op_p};
+       });
        $self->wq_io_do('do_auth', []);
        $self->wq_close(1);
-       $lei->event_step_init; # wait for shutdowns
-       if ($lei->{oneshot}) {
-               while ($op->{sock}) { $op->event_step }
-       }
+       while ($op && $op->{sock}) { $op->event_step }
 }
 
 sub ipc_atfork_child {