use Compress::Raw::Zlib qw/Z_OK Z_FULL_FLUSH Z_SYNC_FLUSH MAX_WBITS/;
use Config::Tiny ();
+use Errno 'EINTR';
use Net::SSLeay ();
use List::Util qw/all first/;
use POSIX ':signal_h';
vec(my $rin, fileno($self->{STDOUT}), 1) = 1;
while (1) {
- return $read unless
- (defined $self->{_OUTBUF} and $self->{_OUTBUF} ne '') or
- # Unprocessed data within the current TLS record would cause
- # select(2) to block/timeout due to the raw socket not being
- # ready.
- (defined $ssl and Net::SSLeay::pending($ssl) > 0) or
- select($rin, undef, undef, 0) > 0;
+ unless ((defined $self->{_OUTBUF} and $self->{_OUTBUF} ne '') or
+ # Unprocessed data within the current TLS record would
+ # cause select(2) to block/timeout due to the raw socket
+ # not being ready.
+ (defined $ssl and Net::SSLeay::pending($ssl) > 0)) {
+ my $r = CORE::select($rin, undef, undef, 0);
+ next if $r == -1 and $! == EINTR; # select(2) was interrupted
+ $self->panic("Can't select: $!") if $r == -1;
+ return $read if $r == 0; # nothing more to read
+ }
my $x = $self->_getline();
$self->_resp($x, $cmd, undef, $callback);
$read++;