about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTPD/Async.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/HTTPD/Async.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/HTTPD/Async.pm')
-rw-r--r--lib/PublicInbox/HTTPD/Async.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm
index 3eb7f75a..9cc41f17 100644
--- a/lib/PublicInbox/HTTPD/Async.pm
+++ b/lib/PublicInbox/HTTPD/Async.pm
@@ -11,6 +11,7 @@ use warnings;
 use base qw(PublicInbox::DS);
 use fields qw(cb cleanup);
 require PublicInbox::EvCleanup;
+use Errno qw(EAGAIN);
 
 sub new {
         my ($class, $io, $cb, $cleanup) = @_;
@@ -57,7 +58,7 @@ sub main_cb ($$$) {
                         }
                         # fall through to close below...
                 } elsif (!defined $r) {
-                        return restart_read($self) if $!{EAGAIN};
+                        return restart_read($self) if $! == EAGAIN;
                 }
 
                 # Done! Error handling will happen in $fh->close