listen($s, 1024);
IO::Handle::blocking($s, 0);
my $self = fields::new($class);
listen($s, 1024);
IO::Handle::blocking($s, 0);
my $self = fields::new($class);
# no loop here, we want to fairly distribute clients
# between multiple processes sharing the same socket
# no loop here, we want to fairly distribute clients
# between multiple processes sharing the same socket
if (my $addr = accept(my $c, $sock)) {
IO::Handle::blocking($c, 0); # no accept4 :<
$self->{post_accept}->($c, $addr, $sock);
if (my $addr = accept(my $c, $sock)) {
IO::Handle::blocking($c, 0); # no accept4 :<
$self->{post_accept}->($c, $addr, $sock);