about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-24 02:52:26 +0000
committerEric Wong <e@80x24.org>2019-06-24 05:26:26 +0000
commit7c89df780b7b160fe85b8a355455d06ec8499205 (patch)
tree5d741af972a2c4418a10a26b90f069e8fc689e9e /lib/PublicInbox/HTTP.pm
parentcee1b928497c002ba03c325cbc6de7022673e2cb (diff)
downloadpublic-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.pm7
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;
         }