]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Listener.pm
www_stream: fix search for new.html endpoint
[public-inbox.git] / lib / PublicInbox / Listener.pm
index 7f9658b89b231f73b2a07a8744954bf4537a1c8c..5f351a775e7bdb227fc6946036ac51ef349774cb 100644 (file)
@@ -1,5 +1,7 @@
 # Copyright (C) 2015 all contributors <meta@public-inbox.org>
 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+#
+# Used by -nntpd for listen sockets
 package PublicInbox::Listener;
 use strict;
 use warnings;
@@ -23,11 +25,12 @@ sub new ($$$) {
 
 sub event_read {
        my ($self) = @_;
+       my $sock = $self->{sock};
        # 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, $sock)) {
                IO::Handle::blocking($c, 0); # no accept4 :<
-               $self->{post_accept}->($c);
+               $self->{post_accept}->($c, $addr, $sock);
        }
 }