about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/LEI.pm15
-rw-r--r--lib/PublicInbox/LeiToMail.pm7
-rw-r--r--lib/PublicInbox/LeiXSearch.pm14
-rw-r--r--lib/PublicInbox/PktOp.pm5
4 files changed, 20 insertions, 21 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 3ff8a347..a337fb0d 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -519,8 +519,7 @@ sub fail ($$;$) {
         my ($self, $buf, $exit_code) = @_;
         $self->{failed}++;
         err($self, $buf) if defined $buf;
-        # calls fail_handler
-        $self->{pkt_op_p}->pkt_do('!') if $self->{pkt_op_p};
+        $self->{pkt_op_p}->pkt_do('fail_handler') if $self->{pkt_op_p};
         x_it($self, ($exit_code // 1) << 8);
         undef;
 }
@@ -552,7 +551,7 @@ sub child_error { # passes non-fatal curl exit codes to user
 sub note_sigpipe { # triggers sigpipe_handler
         my ($self, $fd) = @_;
         close(delete($self->{$fd})); # explicit close silences Perl warning
-        $self->{pkt_op_p}->pkt_do('|') if $self->{pkt_op_p};
+        $self->{pkt_op_p}->pkt_do('sigpipe_handler') if $self->{pkt_op_p};
         x_it($self, 13);
 }
 
@@ -614,11 +613,11 @@ sub incr {
 
 sub pkt_ops {
         my ($lei, $ops) = @_;
-        $ops->{'!'} = [ \&fail_handler, $lei ];
-        $ops->{'|'} = [ \&sigpipe_handler, $lei ];
-        $ops->{x_it} = [ \&x_it, $lei ];
-        $ops->{child_error} = [ \&child_error, $lei ];
-        $ops->{incr} = [ \&incr, $lei ];
+        $ops->{fail_handler} = [ $lei ];
+        $ops->{sigpipe_handler} = [ $lei ];
+        $ops->{x_it} = [ $lei ];
+        $ops->{child_error} = [ $lei ];
+        $ops->{incr} = [ $lei ];
         $ops;
 }
 
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index 467b27bf..d42759cf 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -714,16 +714,15 @@ sub do_post_auth {
                 } else { # Maildir
                         $self->{shard_info} = [ $mod, $shard ];
                 }
-                $aug = '+'; # incr_post_augment
+                $aug = 'incr_post_augment';
         } elsif ($self->{-wq_worker_nr} == 0) { # 1st worker do_augment
-                $aug = '.'; # do_post_augment
+                $aug = 'do_post_augment';
         }
         if ($aug) {
                 local $0 = 'do_augment';
                 eval { do_augment($self, $lei) };
                 $lei->fail($@) if $@;
-                $lei->{pkt_op_p}->pkt_do($aug) == 1 or
-                                die "do_post_augment trigger: $!";
+                $lei->{pkt_op_p}->pkt_do($aug) or die "pkt_do($aug): $!";
         }
         # done augmenting, connect the compressor pipe for each worker
         if (my $zpipe = delete $lei->{zpipe}) {
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 99f887ce..ae9f5881 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -536,16 +536,16 @@ sub do_query {
         my ($self, $lei) = @_;
         my $l2m = $lei->{l2m};
         my $ops = {
-                '|' => [ $lei->can('sigpipe_handler'), $lei ],
-                '!' => [ $lei->can('fail_handler'), $lei ],
-                '.' => [ \&do_post_augment, $lei ],
-                '+' => [ \&incr_post_augment, $lei ],
+                'sigpipe_handler' => [ $lei ],
+                'fail_handler' => [ $lei ],
+                'do_post_augment' => [ \&do_post_augment, $lei ],
+                'incr_post_augment' => [ \&incr_post_augment, $lei ],
                 '' => [ \&query_done, $lei ],
                 'mset_progress' => [ \&mset_progress, $lei ],
                 'l2m_progress' => [ \&l2m_progress, $lei ],
-                'x_it' => [ $lei->can('x_it'), $lei ],
-                'child_error' => [ $lei->can('child_error'), $lei ],
-                'incr_start_query' => [ \&incr_start_query, $self, $l2m ],
+                'x_it' => [ $lei ],
+                'child_error' => [ $lei ],
+                'incr_start_query' => [ $self, $l2m ],
         };
         $lei->{auth}->op_merge($ops, $l2m) if $l2m && $lei->{auth};
         my $end = $lei->pkt_op_pair;
diff --git a/lib/PublicInbox/PktOp.pm b/lib/PublicInbox/PktOp.pm
index 10942dd1..fd2569ba 100644
--- a/lib/PublicInbox/PktOp.pm
+++ b/lib/PublicInbox/PktOp.pm
@@ -13,6 +13,7 @@ use Errno qw(EAGAIN EINTR);
 use PublicInbox::Syscall qw(EPOLLIN EPOLLET);
 use Socket qw(AF_UNIX MSG_EOR SOCK_SEQPACKET);
 use PublicInbox::IPC qw(ipc_freeze ipc_thaw);
+use Scalar::Util qw(blessed);
 
 sub new {
         my ($cls, $r) = @_;
@@ -57,8 +58,8 @@ sub event_step {
                 }
                 my $op = $self->{ops}->{$cmd //= $msg};
                 if ($op) {
-                        my ($sub, @args) = @$op;
-                        $sub->(@args, @pargs);
+                        my ($obj, @args) = (@$op, @pargs);
+                        blessed($obj) ? $obj->$cmd(@args) : $obj->(@args);
                 } elsif ($msg ne '') {
                         die "BUG: unknown message: `$cmd'";
                 }