[Pharo-project] Issue 3674 in pharo: SocketStream no-timeout streams

pharo at googlecode.com pharo at googlecode.com
Sun Feb 6 22:50:57 CET 2011

Status: FixedWaitingToBePharoed
Owner: stephane... at gmail.com

New issue 3674 by stephane... at gmail.com: SocketStream no-timeout streams

One day we will have to fix all the network package...
and it may be worth to look at this.
Now this should not be integrated as such.
We will have to really check carefully

Name: Network-mtf.105
Author: mtf
Time: 15 January 2011, 8:27:54.184 pm
UUID: 1b2c2f95-fc87-4b1f-a034-4dc2cb793c9b
Ancestors: Network-cmm.103

the SocketStream refactor broke the semantics of no-timeout streams. no  
timeout is supposed to mean we wait potentially forever. It was broken to  
mean timeout silently rather than with a signal.

=============== Diff against Network-cmm.103 ===============

Item was added:
+ ----- Method: BrowserUrl>>retrieveContentsForBrowser: (in  
category 'downloading') -----
+ retrieveContentsForBrowser: aBrowser
+       ^aBrowser browserUrlContents: locator!

Item was changed:
  ----- Method: SocketStream>>receiveData (in category 'private-socket')  
+       self waitForData.
-       "Receive data. Signal exceptions and timeouts depending on  
#shouldSignal and #shouldTimeout. Return the position in the buffer where  
the new data starts, regardless if anything was read."
-       socket
-               waitForDataFor: self timeout
-               ifClosed: [self shouldSignal
-                       ifTrue:[ConnectionClosed signal: 'Connection closed  
while waiting for data.']]
-               ifTimedOut: [self shouldTimeout
-                       ifTrue:[ConnectionTimedOut signal: 'Data receive  
timed out.']].
        ^self receiveAvailableData!

Item was added:
+ ----- Method: SocketStream>>signalClosed (in category 'private-socket')  
+ signalClosed
+       self shouldSignal ifFalse: [^ self].
+       ConnectionClosed signal: 'Connection closed while waiting for  

Item was added:
+ ----- Method: SocketStream>>signalTimeout (in category 'private-socket')  
+ signalTimeout
+       self shouldSignal ifFalse: [^ self].
+       ConnectionTimedOut signal: 'Data receive timed out.'!

Item was added:
+ ----- Method: SocketStream>>waitForData (in category 'private-socket')  
+ waitForData
+       "Wait for data. If shouldTimeout, we will time out if nothing  
arrives, otherwise we wait indefinitely"
+       self shouldTimeout
+               ifTrue: [socket waitForDataFor: self timeout
+                       ifClosed: [self signalClosed]
+                       ifTimedOut: [self signalTimeout]]
+               ifFalse: [socket waitForDataIfClosed: [self signalClosed]]!

More information about the Pharo-project mailing list