mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Fix keepalive bugs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27249 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
042b126345
commit
f0d838c18b
3 changed files with 18 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-12-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSConnection.h:
|
||||
* Source/NSConnection.m:
|
||||
Fix keepalive bugs.
|
||||
|
||||
2008-12-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Additions/GNUstepBase/NSTask+GS.h: NSTask category
|
||||
|
|
|
@ -102,7 +102,7 @@ GS_EXPORT NSString* const NSConnectionProxyCount; /* Objects received */
|
|||
BOOL _multipleThreads;
|
||||
BOOL _shuttingDown;
|
||||
BOOL _useKeepalive;
|
||||
BOOL _dummy;
|
||||
BOOL _keepaliveWait;
|
||||
NSPort *_receivePort;
|
||||
NSPort *_sendPort;
|
||||
unsigned _requestDepth;
|
||||
|
|
|
@ -2335,13 +2335,14 @@ static void retEncoder (DOContext *ctxt)
|
|||
GSIMapNode node;
|
||||
|
||||
[rmc decodeValueOfObjCType: @encode(int) at: &sequence];
|
||||
if (type == ROOTPROXY_REPLY
|
||||
&& _lastKeepalive != 0 && sequence == _lastKeepalive)
|
||||
if (type == ROOTPROXY_REPLY && conn->_keepaliveWait == YES
|
||||
&& sequence == conn->_lastKeepalive)
|
||||
{
|
||||
_lastKeepalive = 0;
|
||||
conn->_keepaliveWait = NO;
|
||||
NSDebugMLLog(@"NSConnection", @"Handled keepalive %d on %@",
|
||||
sequence, conn);
|
||||
[self _doneInRmc: rmc];
|
||||
break;
|
||||
}
|
||||
M_LOCK(conn->_queueGate);
|
||||
node = GSIMapNodeForKey(conn->_replyMap, (GSIMapKey)sequence);
|
||||
|
@ -2406,13 +2407,14 @@ static void retEncoder (DOContext *ctxt)
|
|||
{
|
||||
if ([self isValid])
|
||||
{
|
||||
if (_lastKeepalive == 0)
|
||||
if (_keepaliveWait == NO)
|
||||
{
|
||||
NSPortCoder *op;
|
||||
|
||||
/* Send out a root proxy request to ping the other end.
|
||||
*/
|
||||
op = [self _makeOutRmc: 0 generate: &_lastKeepalive reply: NO];
|
||||
_keepaliveWait = YES;
|
||||
[self _sendOutRmc: op type: ROOTPROXY_REQUEST];
|
||||
}
|
||||
else
|
||||
|
@ -2429,7 +2431,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
- (void) _enableKeepalive
|
||||
{
|
||||
_useKeepalive = YES; /* Set so that child connections will inherit. */
|
||||
_lastKeepalive = 0;
|
||||
_keepaliveWait = NO;
|
||||
if (_receivePort != _sendPort)
|
||||
{
|
||||
/* If this is not a listening connection, we actually enable the
|
||||
|
@ -3114,6 +3116,8 @@ static void callEncoder (DOContext *ctxt)
|
|||
sendPort: _sendPort
|
||||
components: nil];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &sno];
|
||||
NSDebugMLLog(@"NSConnection",
|
||||
@"Make out RMC %u on %@", sno, self);
|
||||
return coder;
|
||||
}
|
||||
|
||||
|
@ -3159,8 +3163,8 @@ static void callEncoder (DOContext *ctxt)
|
|||
break;
|
||||
}
|
||||
|
||||
if (debug_connection > 5)
|
||||
NSLog(@"Sending %@ on %@", stringFromMsgType(msgid), self);
|
||||
NSDebugMLLog(@"NSConnection",
|
||||
@"Sending %@ on %@", stringFromMsgType(msgid), self);
|
||||
|
||||
limit = [dateClass dateWithTimeIntervalSinceNow: _requestTimeout];
|
||||
sent = [_sendPort sendBeforeDate: limit
|
||||
|
|
Loading…
Reference in a new issue