Fixes for occasional possible hangups.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14489 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-09-19 16:24:20 +00:00
parent 39881bc7cb
commit 2af43e66f2
3 changed files with 27 additions and 6 deletions

View file

@ -1,5 +1,11 @@
2002-09-19 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpHandle.m: Check port for invalidation while looping
on write events, so we can fail if we become invalid while sending
or connecting, before the port timeout expires.
* Source/NSConnection.m: Check connection for invalidation while
looping waiting for a reply, so we can fail if we become invalid
before the timeout expires.
* Source/DocMakefile: Specify template options
* Tools/autogsdoc.m: Remove hack to turn templates on by default.
Document the use of templates.

View file

@ -556,7 +556,8 @@ static Class runLoopClass;
type: ET_EDESC
watcher: self
forMode: NSConnectionReplyMode];
while (state == GS_H_TRYCON && [when timeIntervalSinceNow] > 0)
while (valid == YES && state == GS_H_TRYCON
&& [when timeIntervalSinceNow] > 0)
{
[l runMode: NSConnectionReplyMode beforeDate: when];
}
@ -1154,6 +1155,10 @@ static Class runLoopClass;
type: ET_WDESC
forMode: mode
all: NO];
[l removeEvent: data
type: ET_EDESC
forMode: mode
all: NO];
}
}
}
@ -1183,7 +1188,8 @@ static Class runLoopClass;
type: ET_WDESC
watcher: self
forMode: NSConnectionReplyMode];
while ([wMsgs indexOfObjectIdenticalTo: components] != NSNotFound
while (valid == YES
&& [wMsgs indexOfObjectIdenticalTo: components] != NSNotFound
&& [when timeIntervalSinceNow] > 0)
{
DO_UNLOCK(myLock);

View file

@ -2655,7 +2655,7 @@ static void callEncoder (DOContext *ctxt)
- _getReplyRmc: (int)sn
{
NSPortCoder *rmc;
GSIMapNode node;
GSIMapNode node = 0;
NSDate *timeout_date = nil;
NSTimeInterval last_interval = 0.0001;
NSTimeInterval delay_interval = last_interval;
@ -2666,7 +2666,8 @@ static void callEncoder (DOContext *ctxt)
NSLog(@"Waiting for reply sequence %d on %x:%x",
sn, self, [NSThread currentThread]);
M_LOCK(_queueGate);
while ((node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn)) != 0
while (_isValid == YES
&& (node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn)) != 0
&& node->value.obj == dummyObject)
{
M_UNLOCK(_queueGate);
@ -2765,8 +2766,16 @@ static void callEncoder (DOContext *ctxt)
}
if (rmc == dummyObject)
{
[NSException raise: NSPortTimeoutException
format: @"timed out waiting for reply"];
if (_isValid == YES)
{
[NSException raise: NSPortTimeoutException
format: @"timed out waiting for reply"];
}
else
{
[NSException raise: NSPortTimeoutException
format: @"invalidated while awaiting reply"];
}
}
NSDebugMLLog(@"NSConnection", @"Consuming reply RMC %d on %x", sn, self);
return rmc;