Skip to content

Commit

Permalink
Merge branch 'backlog'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuomingliang committed Dec 4, 2015
2 parents f86f15c + 261e50c commit 3e65897
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/vm/jvm/QAST/Compiler.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ QAST::OperationsJAST.map_classlib_core_op('spurtasync', $TYPE_OPS, 'spurtasync',

QAST::OperationsJAST.map_classlib_core_op('socket', $TYPE_OPS, 'socket', [$RT_INT], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('connect', $TYPE_OPS, 'connect', [$RT_OBJ, $RT_STR, $RT_INT], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('bindsock', $TYPE_OPS, 'bindsock', [$RT_OBJ, $RT_STR, $RT_INT], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('bindsock', $TYPE_OPS, 'bindsock', [$RT_OBJ, $RT_STR, $RT_INT, $RT_INT], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('accept', $TYPE_OPS, 'accept', [$RT_OBJ], $RT_OBJ, :tc);

QAST::OperationsJAST.map_classlib_core_op('debugnoop', $TYPE_OPS, 'debugnoop', [$RT_OBJ], $RT_OBJ, :tc);
Expand Down Expand Up @@ -2717,7 +2717,7 @@ QAST::OperationsJAST.map_classlib_core_op('cancel', $TYPE_OPS, 'cancel', [$RT_OB
QAST::OperationsJAST.map_classlib_core_op('signal', $TYPE_IO_OPS, 'signal', [$RT_OBJ, $RT_OBJ, $RT_INT, $RT_INT, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('watchfile', $TYPE_IO_OPS, 'watchfile', [$RT_OBJ, $RT_OBJ, $RT_STR, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('asyncconnect', $TYPE_IO_OPS, 'asyncconnect', [$RT_OBJ, $RT_OBJ, $RT_STR, $RT_INT, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('asynclisten', $TYPE_IO_OPS, 'asynclisten', [$RT_OBJ, $RT_OBJ, $RT_STR, $RT_INT, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('asynclisten', $TYPE_IO_OPS, 'asynclisten', [$RT_OBJ, $RT_OBJ, $RT_STR, $RT_INT, $RT_INT, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('asyncwritestr', $TYPE_IO_OPS, 'asyncwritestr', [$RT_OBJ, $RT_OBJ, $RT_OBJ, $RT_STR, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('asyncwritebytes', $TYPE_IO_OPS, 'asyncwritebytes', [$RT_OBJ, $RT_OBJ, $RT_OBJ, $RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('asyncreadchars', $TYPE_IO_OPS, 'asyncreadchars', [$RT_OBJ, $RT_OBJ, $RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public AsyncServerSocketHandle(ThreadContext tc) {
}

@Override
public void bind(ThreadContext tc, String host, int port) {
public void bind(ThreadContext tc, String host, int port, int backlog) {
try {
InetSocketAddress addr = new InetSocketAddress(host, port);
listenChan.bind(addr);
listenChan.bind(addr, backlog);
} catch (UnresolvedAddressException uae) {
ExceptionHandling.dieInternal(tc, "Failed to resolve host name");
} catch (IOException e) {
Expand Down
2 changes: 1 addition & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/io/IIOBindable.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

public interface IIOBindable {

public void bind(ThreadContext tc, String host, int port);
public void bind(ThreadContext tc, String host, int port, int backlog);

}
4 changes: 2 additions & 2 deletions src/vm/jvm/runtime/org/perl6/nqp/io/ServerSocketHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public ServerSocketHandle(ThreadContext tc) {
}
}

public void bind(ThreadContext tc, String host, int port) {
public void bind(ThreadContext tc, String host, int port, int backlog) {
try {
InetSocketAddress addr = new InetSocketAddress(host, port);
listenChan.bind(addr);
listenChan.bind(addr, backlog);
} catch (IOException e) {
throw ExceptionHandling.dieInternal(tc, e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/IOOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static SixModelObject asyncconnect(SixModelObject queue, SixModelObject s
}

public static SixModelObject asynclisten(SixModelObject queue, SixModelObject schedulee,
String host, long port, SixModelObject asyncType, ThreadContext tc) {
String host, long port, long backlog, SixModelObject asyncType, ThreadContext tc) {

AsyncTaskInstance task = (AsyncTaskInstance) asyncType.st.REPR.allocate(tc, asyncType.st);
task.queue = queue;
Expand All @@ -42,7 +42,7 @@ public static SixModelObject asynclisten(SixModelObject queue, SixModelObject sc
AsyncServerSocketHandle handle = new AsyncServerSocketHandle(tc);
task.handle = handle;

handle.bind(tc, host, (int) port);
handle.bind(tc, host, (int) port, (int) backlog);
handle.accept(tc, task);

return task;
Expand Down
4 changes: 2 additions & 2 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ public static SixModelObject connect(SixModelObject obj, String host, long port,
return obj;
}

public static SixModelObject bindsock(SixModelObject obj, String host, long port, ThreadContext tc) {
public static SixModelObject bindsock(SixModelObject obj, String host, long port, long backlog, ThreadContext tc) {
IOHandleInstance h = (IOHandleInstance)obj;
if (h.handle instanceof IIOBindable) {
((IIOBindable)h.handle).bind(tc, host, (int) port);
((IIOBindable)h.handle).bind(tc, host, (int) port, (int)backlog);
} else {
ExceptionHandling.dieInternal(tc,
"This handle does not support bind");
Expand Down

0 comments on commit 3e65897

Please sign in to comment.