diff --git a/ChangeLog b/ChangeLog index 53126cc79..6e735a99b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,9 @@ decoded as the host to which the GSTcpHandle is talking. Modified in various places to keep a record of the IP address of the remote end of the connection, so we can pass this to decodePort() + ([-getFds:count:]) fixed error in determining set of file descriptors + to listen to - resulted in two threads listening to the same descriptor + at the same time! 2000-11-13 Richard Frith-Macdonald diff --git a/Source/GSTcpPort.m b/Source/GSTcpPort.m index 8875b2f47..aa82ef0a6 100644 --- a/Source/GSTcpPort.m +++ b/Source/GSTcpPort.m @@ -1530,6 +1530,7 @@ static Class tcpPortClass; NSMapEnumerator me; int sock; GSTcpHandle *handle; + id recvSelf; DO_LOCK(myLock); @@ -1542,15 +1543,23 @@ static Class tcpPortClass; * Put in our listening socket. */ *count = 0; - fds[(*count)++] = listener; + if (listener >= 0) + { + fds[(*count)++] = listener; + } /* - * Enumerate all our socket handles, and put them in. + * Enumerate all our socket handles, and put them in as long as they + * are to be used for receiving. */ + recvSelf = GS_GC_HIDE(self); me = NSEnumerateMapTable(handles); while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle)) { - fds[(*count)++] = sock; + if (handle->recvPort == recvSelf) + { + fds[(*count)++] = sock; + } } DO_UNLOCK(myLock); } diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 7d38dcbdd..d37872f63 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -1648,7 +1648,7 @@ static BOOL multi_threaded = NO; } if (debug_connection > 4) { - NSLog(@" connection is %x", conn); + NSLog(@" connection is %x:%x", conn, [NSThread currentThread]); } if (conn->_authenticateIn == YES @@ -2103,7 +2103,8 @@ static BOOL multi_threaded = NO; NSDate *timeout_date = nil; if (debug_connection > 5) - NSLog(@"Waiting for reply sequence %d on %x", sn, self); + NSLog(@"Waiting for reply sequence %d on %x:%x", + sn, self, [NSThread currentThread]); M_LOCK(_queueGate); while ((node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn)) != 0 && node->value.obj == dummyObject)