fixed a bug in socket accept

This commit is contained in:
hyunghwan.chung 2018-01-14 15:11:53 +00:00
parent 2b56b1c2b0
commit 2255425b3f
3 changed files with 11 additions and 4 deletions

View File

@ -242,7 +242,7 @@ class(#pointer) Y(X)
class Socket(Object) from 'sck' class Socket(Object) from 'sck'
{ {
var handle := -1. var(#get) handle := -1.
var insem, outsem. var insem, outsem.
var(#get,#set) inputAction, outputAction. var(#get,#set) inputAction, outputAction.
@ -491,9 +491,11 @@ error -> exception
newaddr := SocketAddress new. newaddr := SocketAddress new.
newsck := sck accept: newaddr. newsck := sck accept: newaddr.
System log: 'new connection - '; logNl: newaddr.
System log: 'new connection - '; log: newaddr; log: ' '; log: (newsck handle); logNl.
newsck inputAction: inact; outputAction: outact. newsck inputAction: inact; outputAction: outact.
newsck watchInput; watchOuptut. newsck watchInput; watchOutput.
]. ].
[ [

View File

@ -210,6 +210,11 @@ TODO: how to pass all variadic arguments to another variadic methods???
^self atLevel: System.Log.INFO log: message and: message2. ^self atLevel: System.Log.INFO log: message and: message2.
} }
method(#class) logNl
{
^self atLevel: System.Log.INFO log: S'\n'.
}
method(#class) logNl: message method(#class) logNl: message
{ {
^self atLevel: System.Log.INFO logNl: message. ^self atLevel: System.Log.INFO logNl: message.

View File

@ -192,7 +192,7 @@ static moo_pfrc_t pf_accept_socket (moo_t* moo, moo_ooi_t nargs)
} }
newsck->handle = MOO_SMOOI_TO_OOP(newfd); newsck->handle = MOO_SMOOI_TO_OOP(newfd);
MOO_STACK_SETRETTORCV (moo, nargs); MOO_STACK_SETRET (moo, nargs, (moo_oop_t)newsck);
return MOO_PF_SUCCESS; return MOO_PF_SUCCESS;
} }