diff options
author | Eric Wong <e@80x24.org> | 2021-09-25 06:17:54 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-25 08:53:48 +0000 |
commit | d0100ddd9fe00197cc846d83e70b7611c57dbf43 (patch) | |
tree | e52ddb16cffcb623c7076fd026dde5037fc19933 /lib/PublicInbox/LEI.pm | |
parent | 562cae2dc6dfd8b6ae85094115f67fe8d57cec8e (diff) | |
download | public-inbox-d0100ddd9fe00197cc846d83e70b7611c57dbf43.tar.gz |
Since switching to SOCK_SEQUENTIAL, we no longer have to use fixed-width records to guarantee atomic reads. Thus we can maintain more human-readable/searchable PktOp opcodes. Furthermore, we can infer the subroutine name in many cases to avoid repeating ourselves by specifying a command-name twice (e.g. $ops->{CMD} => [ \&CMD, $obj ]; can now simply be written as: $ops->{CMD} => [ $obj ] if CMD is a method of $obj.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r-- | lib/PublicInbox/LEI.pm | 15 |
1 files changed, 7 insertions, 8 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; } |