Enable keepalive for message port connections on windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27320 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-12-17 08:49:50 +00:00
parent a4f370cebb
commit 27b8c6be12
3 changed files with 17 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2008-12-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSConnection.m:
* Tools/gdnc.m:
Enable keepalive only on mswindows and for server connections using
NSMessagePort.
2008-12-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSLock.m: Tiny cleanup of lock finalisation process.

View file

@ -1634,6 +1634,16 @@ static NSLock *cached_proxies_gate = nil;
- (void) setRootObject: (id)anObj
{
setRootObjectForInPort(anObj, _receivePort);
#if defined(__MINGW32__)
/* On ms-windows, the operating system does not inform us when the remote
* client of a message port goes away ... so we need to enable keepalive
* to detect that condition.
*/
if ([_receivePort isKindOfClass: [NSMessagePort class]])
{
[self _enableKeepalive];
}
#endif
}
/**

View file

@ -174,10 +174,6 @@ ihandler(int sig)
}
@end
@interface NSConnection (Private)
- (void) _enableKeepalive;
@end
@interface GDNCNotification : NSObject
{
@public
@ -448,14 +444,6 @@ ihandler(int sig)
conn = [[NSConnection alloc] initWithReceivePort: port sendPort: nil];
[conn setRootObject: self];
/* For ms-windows we need to enable keepalive on the connection so that
* we will find out if the remote end goes away.
*/
if ([conn respondsToSelector: @selector(_enableKeepalive)])
{
[conn _enableKeepalive];
}
if ([hostname length] == 0
|| [[NSHost hostWithName: hostname] isEqual: [NSHost currentHost]] == YES)
{