discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GSDataOutputStream doesn't send events correctly


From: Jens Alfke
Subject: GSDataOutputStream doesn't send events correctly
Date: Thu, 1 Mar 2012 12:09:15 -0800

Now that the block crasher is fixed, I can move on to the next set of problems 
in porting my code :)

I’ve got some async stream-processing code using NSStream that gets stuck. It 
looks like what’s happening is:
* Opens NSOutputStream and schedules it
* Returns to its caller and waits asynchronously for 
NSStreamEventHasSpaceAvailable.
* When it gets that event, it writes its available data to the stream and 
returns
… and then it never gets another NSStreamEventHasSpaceAvailable event

This seems to contradict Apple’s docs, which say "once the [output] stream 
object has been opened, it keeps sending stream:handleEvent: messages to its 
delegate (as long as the delegate continues to put bytes on the stream) until 
it encounters the end of the stream.” [Stream Programming Guide, “Writing To 
Output Streams”]

I’m getting this with an output stream created by +outputStreamToMemory. 
Looking at the implementation in GSStream.m, I don’t see anything that would 
cause a GSDataOutputStream to send more than _one_ 
NSStreamEventHasSpaceAvailable event in its lifetime.

Obviously using the async API with a data-output stream is kind of silly, but 
this is just a unit test of some code that normally operates on file or network 
streams. I haven’t delved into the implementation of those, so I don’t know if 
they have the same incorrect(?) semantics or not…

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]