Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
expose the backlog arg for listen
  • Loading branch information
zhuomingliang committed Nov 1, 2015
1 parent d98dc80 commit 9f5b94e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/IO/Socket/Async.pm
Expand Up @@ -147,7 +147,7 @@ my class IO::Socket::Async {
$p
}

method listen(IO::Socket::Async:U: Str() $host, Int() $port,
method listen(IO::Socket::Async:U: Str() $host, Int() $port, Int() $backlog = 128,
:$scheduler = $*SCHEDULER) {
my $cancellation;
Supply.on-demand(-> $s {
Expand All @@ -163,7 +163,7 @@ my class IO::Socket::Async {
$s.emit($client_socket);
}
},
$host, $port, SocketCancellation);
$host, $port, $backlog, SocketCancellation);
},
closing => {
$cancellation && nqp::cancel($cancellation)
Expand Down
3 changes: 2 additions & 1 deletion src/core/IO/Socket/INET.pm
Expand Up @@ -21,6 +21,7 @@ my class IO::Socket::INET does IO::Socket {
has Int $.port = 80;
has Str $.localhost;
has Int $.localport;
has Int $.backlog;
has Bool $.listen;
has $.family = PIO::PF_INET;
has $.proto = PIO::PROTO_TCP;
Expand Down Expand Up @@ -72,7 +73,7 @@ my class IO::Socket::INET does IO::Socket {
#which is derived from the protocol, is SOCK_STREAM then connect() is called.
if $.listen || $.localhost || $.localport {
nqp::bindsock($PIO, nqp::unbox_s($.localhost || "0.0.0.0"),
nqp::unbox_i($.localport || 0));
nqp::unbox_i($.localport || 0), nqp::unbox_i($.backlog || 128));
}

if $.listen {
Expand Down

0 comments on commit 9f5b94e

Please sign in to comment.