about summary refs log tree commit homepage
path: root/lib/PublicInbox/Listener.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-04 20:18:46 +0000
committerEric Wong <e@80x24.org>2016-01-04 20:23:30 +0000
commite9cec9873b585f2552e2bf9bcbcc44de34caa53d (patch)
tree75c877f11fba9a9d76874d06fa70ea973df0328f /lib/PublicInbox/Listener.pm
parent3f0c40d5ae38163cc6494a5a9491b4fb4171847d (diff)
downloadpublic-inbox-e9cec9873b585f2552e2bf9bcbcc44de34caa53d.tar.gz
We can avoid making getpeername syscalls this way.
Diffstat (limited to 'lib/PublicInbox/Listener.pm')
-rw-r--r--lib/PublicInbox/Listener.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Listener.pm b/lib/PublicInbox/Listener.pm
index 67817d9f..8e0554f3 100644
--- a/lib/PublicInbox/Listener.pm
+++ b/lib/PublicInbox/Listener.pm
@@ -27,9 +27,9 @@ sub event_read {
         my ($self) = @_;
         # no loop here, we want to fairly distribute clients
         # between multiple processes sharing the same socket
-        if (accept(my $c, $self->{sock})) {
+        if (my $addr = accept(my $c, $self->{sock})) {
                 IO::Handle::blocking($c, 0); # no accept4 :<
-                $self->{post_accept}->($c);
+                $self->{post_accept}->($c, $addr);
         }
 }