handle invalidation of connection while getting root proxy

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37768 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2014-03-26 07:56:09 +00:00
parent f5326c8db1
commit 974fa5d811
3 changed files with 29 additions and 16 deletions

View file

@ -1673,20 +1673,32 @@ static NSLock *cached_proxies_gate = nil;
NSParameterAssert(IreceivePort);
NSParameterAssert(IisValid);
/*
* If this is a server connection without a remote end, its root proxy
* is the same as its root object.
*/
if (IreceivePort == IsendPort)
NS_DURING
{
return [self rootObject];
}
op = [self _makeOutRmc: 0 generate: &seq_num reply: YES];
[self _sendOutRmc: op type: ROOTPROXY_REQUEST];
/*
* If this is a server connection without a remote end, its root proxy
* is the same as its root object.
*/
if (IreceivePort == IsendPort)
{
return [self rootObject];
}
op = [self _makeOutRmc: 0 generate: &seq_num reply: YES];
[self _sendOutRmc: op type: ROOTPROXY_REQUEST];
ip = [self _getReplyRmc: seq_num];
[ip decodeValueOfObjCType: @encode(id) at: &newProxy];
[self _doneInRmc: ip];
}
NS_HANDLER
{
/* The ports/connection may have been invalidated while getting the
* root proxy ... if so we should return nil.
*/
newProxy = nil;
}
NS_ENDHANDLER
ip = [self _getReplyRmc: seq_num];
[ip decodeValueOfObjCType: @encode(id) at: &newProxy];
[self _doneInRmc: ip];
return AUTORELEASE(newProxy);
}