improve test for eof on socket

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24085 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-11-14 06:46:40 +00:00
parent ac64c81310
commit 52894efa44

View file

@ -1204,10 +1204,24 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
*/
if (sock != nil)
{
NSRunLoop *loop = [NSRunLoop currentRunLoop];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSRunLoop *loop = [NSRunLoop currentRunLoop];
NSFileHandle *test = RETAIN(sock);
[nc addObserver: self
selector: @selector(bgdTunnelRead:)
name: NSFileHandleReadCompletionNotification
object: test];
if ([test readInProgress] == NO)
{
[test readInBackgroundAndNotify];
}
[loop acceptInputForMode: NSDefaultRunLoopMode
beforeDate: nil];
[nc removeObserver: self
name: NSFileHandleReadCompletionNotification
object: test];
RELEASE(test);
}
if (sock == nil)