diff options
author | Eric Wong <e@80x24.org> | 2019-06-24 02:52:26 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-06-24 05:26:26 +0000 |
commit | 7c89df780b7b160fe85b8a355455d06ec8499205 (patch) | |
tree | 5d741af972a2c4418a10a26b90f069e8fc689e9e /lib/PublicInbox/HTTP.pm | |
parent | cee1b928497c002ba03c325cbc6de7022673e2cb (diff) | |
download | public-inbox-7c89df780b7b160fe85b8a355455d06ec8499205.tar.gz |
Integer comparisions of "$!" are faster than hash lookups. See commit 6fa2b29fcd0477d126ebb7db7f97b334f74bbcbc ("ds: cleanup Errno imports and favor constant comparisons") for benchmarks.
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 773d77ba..4738e156 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -27,6 +27,7 @@ use constant { CHUNK_ZEND => -3, # \r\n CHUNK_MAX_HDR => 256, }; +use Errno qw(EAGAIN); my $pipelineq = []; my $pipet; @@ -82,11 +83,9 @@ sub event_step { # called by PublicInbox::DS return rbuf_process($self); } - return $self->watch_in1 if $!{EAGAIN}; - # common for clients to break connections without warning, # would be too noisy to log here: - return $self->close; + $! == EAGAIN ? $self->watch_in1 : $self->close; } sub rbuf_process { @@ -359,7 +358,7 @@ sub write_err { sub recv_err { my ($self, $r, $len) = @_; return $self->close if (defined $r && $r == 0); - if ($!{EAGAIN}) { + if ($! == EAGAIN) { $self->{input_left} = $len; return $self->watch_in1; } |