Status: FixedWaitingToBePharoed
Owner: [email protected]

New issue 3674 by [email protected]: SocketStream no-timeout streams
http://code.google.com/p/pharo/issues/detail?id=3674

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') -----
 receiveData
+       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 data.'!

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]]!



Reply via email to