diff --git a/ChangeLog b/ChangeLog index aeffeb2..1fc4e0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ +2008-02-27 Paolo Bonzini + + * gst-tool.c: Fix pasto. + * scripts/Remote.st: Change default port to 12345. + 2008-02-25 Paolo Bonzini * kernel/PkgLoader.st: Add start/stop script support. * scripts/Load.st: Add start/stop script support. * scripts/Remote.st: Add start/stop script support. - * gst-load.c: Keep options synchronized. + * gst-tool.c: Keep options synchronized. 2008-02-25 Paolo Bonzini diff --git a/gst-tool.c b/gst-tool.c index 519ae4d..8e547cb 100644 --- a/gst-tool.c +++ b/gst-tool.c @@ -129,7 +129,7 @@ struct tool tools[] = { { "gst-remote", "scripts/Remote.st", - "-h|--help --version --daemon --server -p|--port -f|--file: -e|--eval: \ - -package: --start: --stop: --pid --kill --snapshot:: -I|--image-file: \ + "-h|--help --version --daemon --server -p|--port: -f|--file: -e|--eval: \ + --package: --start: --stop: --pid --kill --snapshot:: -I|--image-file: \ --kernel-directory:", NULL }, diff --git a/packages/tcp/AbstractSocketImpl.st b/packages/tcp/AbstractSocketImpl.st index 2617a54..91a4aa7 100644 --- a/packages/tcp/AbstractSocketImpl.st +++ b/packages/tcp/AbstractSocketImpl.st @@ -78,12 +78,13 @@ FileDescriptor subclass: AbstractSocketImpl [ active server socket." - | peer sizePtr newFD | + | peer sizePtr newFD fd | peer := ByteArray new: CSockAddrStruct sizeof. sizePtr := ByteArray new: CInt sizeof. sizePtr intAt: 1 put: CSockAddrStruct sizeof. + (fd := self fd) isNil ifTrue: [ ^SystemExceptions.EndOfStream signal ]. newFD := self - accept: self fd + accept: fd peer: peer addrLen: sizePtr. ^(implementationClass on: newFD) @@ -105,11 +106,12 @@ FileDescriptor subclass: AbstractSocketImpl [ attaching the local endpoint of the socket." - | addr | + | addr fd | addr := ipAddress port: port. + (fd := self fd) isNil ifTrue: [ ^self ]. [self - bind: self fd + bind: fd to: addr addrLen: addr size. File checkError] @@ -194,12 +196,13 @@ FileDescriptor subclass: AbstractSocketImpl [ local endpoint of the socket." - | sock sizePtr | + | sock sizePtr fd | sock := ByteArray new: CSockAddrStruct sizeof. sizePtr := ByteArray new: CInt sizeof. sizePtr intAt: 1 put: CSockAddrStruct sizeof. + (fd := self fd) isNil ifTrue: [ ^nil ]. self - getSockName: self fd + getSockName: fd addr: sock addrLen: sizePtr. ^sock @@ -210,7 +213,9 @@ FileDescriptor subclass: AbstractSocketImpl [ queue of the given size." - self listen: self fd log: backlog + | fd | + (fd := self fd) isNil ifTrue: [ ^self ]. + self listen: fd log: backlog ] connectTo: ipAddress port: port [ @@ -272,12 +277,13 @@ FileDescriptor subclass: AbstractSocketImpl [ so this will be rarely used." - | result sizeArray | + | result sizeArray fd | result := ByteArray new: size. sizeArray := ByteArray new: CInt sizeof. sizeArray intAt: 1 put: size. + (fd := self fd) isNil ifTrue: [ ^nil ]. self - option: self fd + option: fd level: level at: opt get: result @@ -293,10 +299,11 @@ FileDescriptor subclass: AbstractSocketImpl [ used." - | ba | + | ba fd | ba := self makeByteArray: anObject. + (fd := self fd) isNil ifTrue: [ ^self ]. self - option: self fd + option: fd level: level at: opt put: ba @@ -514,11 +521,12 @@ AbstractSocketImpl subclass: SocketImpl [ machine." - | addr | + | addr fd | addr := ipAddress port: port. - [self - connect: self fd + [(fd := self fd) isNil ifTrue: [ ^self ]. + self + connect: fd to: addr addrLen: addr size. File checkError] @@ -534,10 +542,11 @@ AbstractSocketImpl subclass: SocketImpl [ remote endpoint of the socket." - | peer sizePtr | + | peer sizePtr fd | peer := ByteArray new: CSockAddrStruct sizeof. sizePtr := ByteArray new: CInt sizeof. sizePtr intAt: 1 put: CSockAddrStruct sizeof. + (fd := self fd) isNil ifTrue: [ ^nil ]. self getPeerName: self fd addr: peer @@ -632,13 +641,14 @@ AbstractSocketImpl subclass: DatagramSocketImpl [ to only peek for it without removing it from the queue." - | address port data from addrLen | + | address port data from addrLen fd | addrLen := ByteArray new: CInt sizeof. data := ByteArray new: self bufferSize. from := ByteArray new: CSockAddrStruct sizeof. addrLen intAt: 1 put: from size. + (fd := self fd) isNil ifTrue: [ ^SystemExceptions.EndOfStream signal ]. self - receive: self fd + receive: fd buffer: data size: data size flags: (self flags bitOr: flags) @@ -656,14 +666,15 @@ AbstractSocketImpl subclass: DatagramSocketImpl [ "Send aDatagram on the socket to the given receiver and port" - | size receiver | + | size receiver fd | theReceiver isNil ifTrue: [receiver := size := 0] ifFalse: [receiver := theReceiver port: port. size := receiver size]. + (fd := self fd) isNil ifTrue: [ ^SystemExceptions.EndOfStream signal ]. self - send: self fd + send: fd buffer: aDatagram data size: aDatagram data size flags: self flags diff --git a/packages/tcp/ChangeLog b/packages/tcp/ChangeLog index bdf246e..5ddd9d6 100644 --- a/packages/tcp/ChangeLog +++ b/packages/tcp/ChangeLog @@ -1,3 +1,8 @@ +2008-02-27 Paolo Bonzini + + * AbstractSocketImpl.st: Make sure fd is not nil when calling + out to C. + 2008-02-08 Paolo Bonzini * Sockets.st: Add #isPeerAlive to AbstractSocket. diff --git a/scripts/Remote.st b/scripts/Remote.st index d0640ed..fe9a475 100644 --- a/scripts/Remote.st +++ b/scripts/Remote.st @@ -70,7 +70,7 @@ TextCollector subclass: MultiplexingTextCollector [ | helpString commands server port host | commands := OrderedCollection new. server := false. -port := 5432. +port := 12345. host := nil. helpString := @@ -80,7 +80,7 @@ helpString := Options: --daemon start background server --server start daemon - -p --port=PORT connect/listen on given port (default 5432) + -p --port=PORT connect/listen on given port (default 12345) -f --file=FILE file in FILE -e --eval=CODE evaluate CODE --kill kill daemon @@ -95,7 +95,7 @@ Options: "Parse the command-line arguments." Smalltalk - arguments: '-h|--help --version --daemon --server -p|--port -f|--file: + arguments: '-h|--help --version --daemon --server -p|--port: -f|--file: -e|--eval: --pid --kill --snapshot:: --start: --stop: --package: -I|--image: --kernel-directory:' do: [ :opt :arg |