Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #569 from zhuomingliang/backlog
Expose the backlog arg for listen
  • Loading branch information
diakopter committed Dec 4, 2015
2 parents 5b8c080 + c981d28 commit 8d6ac86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/IO/Socket/Async.pm
Expand Up @@ -108,7 +108,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 @@ -124,7 +124,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 $.listening;
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 $.listening || $.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 $.listening {
Expand Down
2 changes: 1 addition & 1 deletion tools/build/NQP_REVISION
@@ -1 +1 @@
2015.11-28-g01aba47
2015.11-33-g52ded1d

0 comments on commit 8d6ac86

Please sign in to comment.