X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FLEI.pm;h=d81ca296250b493f4e05e1c00bcd2b7bb74781c3;hb=23af251dd607c4e75ab1e68063f2c885c48cc035;hp=4bd9183e969247da542c2c70a8b4d9935c8b8733;hpb=88c7c7c26b44ee4c1141fddb628a518b4d4d21a4;p=public-inbox.git diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 4bd9183e..d81ca296 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -6,8 +6,7 @@ # local clients with read/write access to the FS and use as many # system resources as the local user has access to. package PublicInbox::LEI; -use strict; -use v5.10.1; +use v5.12; use parent qw(PublicInbox::DS PublicInbox::LeiExternal PublicInbox::LeiQuery); use Getopt::Long (); @@ -660,6 +659,7 @@ sub wait_wq_events { for my $wq (grep(defined, @$lei{qw(ikw pmd)})) { # auxiliary WQs $wq->wq_close; } + $wq1->{lei_sock} = $lei->{sock} if $wq1; $op_c->{ops} = $ops; } @@ -1394,7 +1394,7 @@ sub wq_done_wait { # dwaitpid callback local $current_lei = $lei; my $err_type = $lei->{-err_type}; $? and $lei->child_error($?, - $err_type ? "$err_type errors during $lei->{cmd}" : ()); + $err_type ? "$err_type errors during $lei->{cmd} \$?=$?" : ()); $lei->dclose; } @@ -1405,9 +1405,11 @@ sub fchdir { } sub wq_eof { # EOF callback for main daemon - my ($lei) = @_; + my ($lei, $wq_fld) = @_; local $current_lei = $lei; - delete $lei->{wq1} // return $lei->fail; # already failed + my $wq = delete $lei->{$wq_fld // 'wq1'}; + $lei->sto_done_request($wq); + $wq // $lei->fail; # already failed } sub watch_state_ok ($) { @@ -1514,8 +1516,10 @@ sub lms { } sub sto_done_request { - my ($lei, $sock) = @_; + my ($lei, $wq) = @_; + return unless $lei->{sto}; local $current_lei = $lei; + my $sock = $wq ? $wq->{lei_sock} : undef; eval { if ($sock //= $lei->{sock}) { # issue, async wait $lei->{sto}->wq_io_do('done', [ $sock ]);