git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25053 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-04-15 09:20:36 +00:00
parent 3117236cd7
commit b6c9a9e42a

View file

@ -1237,25 +1237,23 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
port = @"80";
}
/* An existing socket with keepalive may have been closed by the other
* end. The portable way to detect it is to run the runloop once to
* allow us to be sent a notification about end-of-file.
* On unix systems (google told me it is not reliable on windows) we can
* simply peek on the file descriptor for a much more efficient check.
*/
if (sock != nil)
{
int fd;
if (debug)
{
NSLog(@"%@ check for reusable socket", NSStringFromSelector(_cmd));
}
/* An existing socket with keepalive may have been closed by the other
* end. The portable way to detect it is to run the runloop once to
* allow us to be sent a notification about end-of-file.
* On unix systems (google told me it is not reliable on windows) we can
* simply peek on the file descriptor for a much more efficient check.
*/
#if defined(__MINGW__)
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSRunLoop *loop = [NSRunLoop currentRunLoop];
NSFileHandle *test = RETAIN(sock);
if (debug)
{
NSLog(@"%@ check for reusable socket", NSStringFromSelector(_cmd));
}
[nc addObserver: self
selector: @selector(bgdRead:)
name: NSFileHandleReadCompletionNotification
@ -1271,8 +1269,12 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
object: test];
RELEASE(test);
#else
fd = [sock fileDescriptor];
int fd = [sock fileDescriptor];
if (debug)
{
NSLog(@"%@ check for reusable socket", NSStringFromSelector(_cmd));
}
if (fd >= 0)
{
extern int errno;