Multithread fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8110 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-11-14 06:53:44 +00:00
parent 372f10a1b5
commit 8055927987
3 changed files with 18 additions and 5 deletions

View file

@ -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 <rfm@gnu.org>

View file

@ -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);
}

View file

@ -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)