about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index a9e54a68..42fbb255 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -941,17 +941,12 @@ sub event_step {
 
         use constant LINE_MAX => 512; # RFC 977 section 2.3
         my $rbuf = \($self->{rbuf});
-        my $r;
+        my $r = 1;
 
         if (index($$rbuf, "\n") < 0) {
                 my $off = bytes::length($$rbuf);
-                $r = sysread($self->{sock}, $$rbuf, LINE_MAX, $off);
-                unless (defined $r) {
-                        return $! == EAGAIN ? $self->watch_in1 : $self->close;
-                }
-                return $self->close if $r == 0;
+                $r = $self->do_read($rbuf, LINE_MAX, $off) or return;
         }
-        $r = 1;
         while ($r > 0 && $$rbuf =~ s/\A[ \t\r\n]*([^\r\n]*)\r?\n//) {
                 my $line = $1;
                 return $self->close if $line =~ /[[:cntrl:]]/s;