- return read_input($self) if defined $self->{env};
-
- my $off = bytes::length($self->{rbuf});
- my $r = sysread($self->{sock}, $self->{rbuf}, 8192, $off);
- if (defined $r) {
- return $self->close if $r == 0;
- return rbuf_process($self);
- }
-
- # common for clients to break connections without warning,
- # would be too noisy to log here:
- $! == EAGAIN ? $self->watch_in1 : $self->close;
+ return read_input($self) if ref($self->{env});
+ my $rbuf = $self->{rbuf} // (\(my $x = ''));
+ $self->do_read($rbuf, 8192, bytes::length($$rbuf)) or return;
+ rbuf_process($self, $rbuf);