On 04/20/2011 08:35 PM, Holger Hans Peter Freyther wrote:
> (Delay forSeconds: 3)
> value: [socket next: N]
> onTimeoutDo: [a) socket readBuffer.. -> ptr is back to 1]
>
> so there must be some ensure: [] block that resets the endptr.
No, it's just that "ptr := 1" is set before calling the fillBlock. I
can apply this patch:
diff --git a/packages/sockets/Buffers.st b/packages/sockets/Buffers.st
index 2084797..de02511 100644
--- a/packages/sockets/Buffers.st
+++ b/packages/sockets/Buffers.st
@@ -137,8 +137,8 @@ evaluates an user defined block to try to get some more
data.'>
<category: 'buffer handling'>
self basicAtEnd ifFalse: [^false].
fillBlock isNil ifTrue: [^true].
- ptr := 1.
endPtr := fillBlock value: collection value: collection size.
+ ptr := 1.
^self basicAtEnd
]
but you're walking on thin ice here. Every time you have a timeout,
you should assume that the data structures are in an inconsistent
state (just like when you #terminate a Process). I suggest making
your sockets unbuffered if it's not too much overhead.
Paolo
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk