package PublicInbox::IPC;
use v5.12;
use parent qw(Exporter);
-use autodie qw(fork pipe read socketpair sysread);
+use autodie qw(close fork pipe read socketpair sysread);
use Carp qw(croak);
use PublicInbox::DS qw(awaitpid);
use PublicInbox::Spawn;
0) // croak "sendmsg: $!";
undef $r;
$n = $send_cmd->($w, $fds, $buf, 0) // croak "sendmsg: $!";
- while ($n < length($buf)) {
- my $x = syswrite($w, $buf, length($buf) - $n, $n);
- if (!defined($n)) {
- next if $!{EINTR};
- croak "syswrite: $!";
- }
- $x or croak "syswrite wrote 0 bytes";
- $n += $x;
- }
+ print $w substr($buf, $n) if $n < length($buf); # need > 2G on Linux
+ close $w; # autodies
}
sub wq_io_do { # always async
$exp = sha1_hex($bigger)."\n";
is(readline($rb), $exp, "SHA WQWorker limit ($t)");
}
+ SKIP: {
+ $ENV{TEST_EXPENSIVE} or skip 'TEST_EXPENSIVE not set', 1;
+ my $bigger = $big x 75000; # over 2G to trigger partial sendmsg
+ $ipc->wq_io_do('test_sha', [ $wa, $wb ], $bigger);
+ my $exp = sha1_hex($bigger)."\n";
+ is(readline($rb), $exp, "SHA WQWorker sendmsg limit ($t)");
+ }
}
# wq_io_do works across fork (siblings can feed)