diff options
author | Eric Wong <e@80x24.org> | 2019-06-24 02:52:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-06-24 05:26:26 +0000 |
commit | 2101e27b937893aa427d8693161966e3673b887e (patch) | |
tree | 1a538c0d2a24ab06e37927a3a642eed47432f40f /lib/PublicInbox/HTTP.pm | |
parent | c100879166cbbd6c2481ce68a549dab7d018d826 (diff) | |
download | public-inbox-2101e27b937893aa427d8693161966e3673b887e.tar.gz |
Both NNTP and HTTP have common needs and we can factor out some common code to make dealing with IO::Socket::SSL easier.
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index fbca9a54..7697ac5c 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -75,17 +75,9 @@ sub event_step { # called by PublicInbox::DS # otherwise we can be buffering infinitely w/o backpressure 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; + my $rbuf = \($self->{rbuf}); + my $off = bytes::length($$rbuf); + $self->do_read($rbuf, 8192, $off) and rbuf_process($self); } sub rbuf_process { |