Hi!

I'm sorry to disturb you further, but I found something weird
while trying what we discussed:

   Eval [
      PackageLoader fileInPackage: #TCP.
      PackageLoader fileInPackage: #ZLib.
   ]
   Eval [
      |zr zw sock|
      sock := TCP.Socket remote: 'localhost' port: 12324.

      zw := RawDeflateStream on: sock.
      zr := RawInflateStream on: sock.

      zw nextPutAll: 'TESTABC'; syncFlush.

      [sock atEnd not] whileTrue: [
         | hunk |
         hunk := zr nextHunk.
         'hunk!' displayNl.
         hunk inspect.
      ].
   ]

I tested this with socat like this:

   socat TCP4-LISTEN:12324,reuseaddr PIPE

The problem is that this line blocks/hangs:

   zr := RawInflateStream on: sock.

It blocks because RawInflateStream>>#on: calls ZlibReadStream>>#fillBuffer
a few method calls down the stack. And fillBuffer actually does
call nextHunk to wait for data to arrive on the line.

If I rearrange the lines btw.:

      zw nextPutAll: 'TESTABC'; syncFlush.
      zr := RawInflateStream on: sock.

Then everything seems to be fine (because there is data for nextHunk).

Would it be possible to prevent the call to fillBuffer to not have
a blocking RawInflateStream creation and only have it block when _I_
call RawInflateStream>>#nextHunk?


Thanks!

Robin


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to