Hi Bill, This was already fixed for 1.4
http://code.google.com/p/pharo/issues/detail?id=5180 It could be backported I guess. Sven On 18 Mar 2012, at 02:11, Schwab,Wilhelm K wrote: > Hello all, > > I did some long overdue networking, and tried ConnectionQueue in 1.3. My > changed version, that appears to work, is below. > > The key to the potential fix is in adding the #yourself to this line: > > newConnection := socket waitForConnectionFor: 10; yourself. > > #waitForConnectionFor: returns true or signals an error, the true ends up > replacing the socket with a boolean and badness results. > > Can anyone confirm this? > > Bill > > > listenLoop > "Private! This loop is run in a separate process. It will establish up to > maxQueueLength connections on the given port." > "Details: When out of sockets or queue is full, retry more frequently, > since a socket may become available, space may open in the queue, or a > previously queued connection may be aborted by the client, making it > available for a fresh connection." > "Note: If the machine is disconnected from the network while the server > is running, the currently waiting socket will go from > 'isWaitingForConnection' to 'unconnected', and attempts to create new sockets > will fail. When this happens, delete the broken socket and keep trying to > create a socket in case the network connection is re-established. Connecting > and disconnecting was tested under PPP on Mac system 8.1. It is not if this > will work on other platforms. > > Fixed to not accept the connection if the queue is full (gvc)." > > > | newConnection | > > socket := Socket newTCP. > "We'll accept four simultanous connections at the same time" > socket listenOn: portNumber backlogSize: 4. > "If the listener is not valid then the we cannot use the > BSD style accept() mechanism." > socket isValid ifFalse: [^self oldStyleListenLoop]. > [true] whileTrue: [ > socket isValid ifFalse: [ > "socket has stopped listening for some reason" > socket destroy. > (Delay forMilliseconds: 10) wait. > ^self listenLoop ]. > [newConnection := socket waitForConnectionFor: 10; yourself. ] > on: ConnectionTimedOut > do: [:ex | newConnection := nil]. > (newConnection notNil and: [newConnection isConnected]) > ifTrue: [(accessSema critical: [connections size < > maxQueueLength]) > ifTrue: [newConnection := socket accept] > ifFalse: [socket closeAndDestroy: 0]] > ifFalse: [newConnection := nil]. > (newConnection notNil and: [newConnection isConnected]) ifTrue: [ > accessSema critical: [connections addLast: newConnection]. > newConnection := nil. > self changed]. > self pruneStaleConnections].
smime.p7s
Description: S/MIME cryptographic signature