Add default for switching between NSSocketPort and NSMessagePort as the default NSPort class.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19832 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2004-08-07 00:44:15 +00:00
parent 303acd3d68
commit d4564c1581
4 changed files with 37 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2004-08-07 02:26 Alexander Malmberg <alexander@malmberg.org>
* Source/NSPort.m (+initialize), Source/NSPortNameServer.m
(systemDefaultPortNameServer): Check the NSPortIsMessagePort to
get the default port class.
* Tools/gdnc.m (-init): Comment on some dead code.
2004-05-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSMime.m: When using non-ascii default characterset

View file

@ -33,6 +33,7 @@
#include "Foundation/NSPortNameServer.h"
#include "Foundation/NSRunLoop.h"
#include "Foundation/NSAutoreleasePool.h"
#include "Foundation/NSUserDefaults.h"
@class NSMessagePort;
@ -65,8 +66,17 @@ Class NSPort_concrete_class;
if (self == [NSPort class])
{
NSPort_abstract_class = self;
NSPort_concrete_class = [NSSocketPort class];
// NSPort_concrete_class = [NSMessagePort class];
/* Must be kept in sync with [NSPortNameServer
+systemDefaultPortNameServer]. */
if ([[NSUserDefaults standardUserDefaults]
boolForKey: @"NSPortIsMessagePort"])
{
NSPort_concrete_class = [NSMessagePort class];
}
else
{
NSPort_concrete_class = [NSSocketPort class];
}
}
}

View file

@ -29,6 +29,7 @@
#include "Foundation/NSException.h"
#include "Foundation/NSPortNameServer.h"
#include "Foundation/NSDebug.h"
#include "Foundation/NSUserDefaults.h"
/**
@ -62,8 +63,16 @@
*/
+ (id) systemDefaultPortNameServer
{
return [NSSocketPortNameServer sharedInstance];
// return [NSMessagePortNameServer sharedInstance];
/* Must be kept in sync with [NSPort +initialize]. */
if ([[NSUserDefaults standardUserDefaults]
boolForKey: @"NSPortIsMessagePort"])
{
return [NSMessagePortNameServer sharedInstance];
}
else
{
return [NSSocketPortNameServer sharedInstance];
}
}
- (void) dealloc

View file

@ -392,6 +392,13 @@ ihandler(int sig)
*/
if (0 && isLocal == YES && service != GDNC_NETWORK)
{
/* If this code is reactivated, it needs to deal correctly with the
case where NSSocketPort shouldn't be used (because it isn't the
default port). Something like
NSPort *port = [NSMessagePort port];
or just
NSPort *port = [NSPort port];
*/
NSPort *port = [NSSocketPort portWithNumber: 0
onHost: [NSHost localHost]
forceAddress: @"127.0.0.1"