diff --git a/ChangeLog b/ChangeLog index fbb48d6c1..ff5e09e7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-08-07 02:26 Alexander Malmberg + + * 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 * Source/GSMime.m: When using non-ascii default characterset diff --git a/Source/NSPort.m b/Source/NSPort.m index 1af30182a..2c136092b 100644 --- a/Source/NSPort.m +++ b/Source/NSPort.m @@ -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]; + } } } diff --git a/Source/NSPortNameServer.m b/Source/NSPortNameServer.m index 7b3530126..ebb78ab3e 100644 --- a/Source/NSPortNameServer.m +++ b/Source/NSPortNameServer.m @@ -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 diff --git a/Tools/gdnc.m b/Tools/gdnc.m index 13df2f26f..38140f52f 100644 --- a/Tools/gdnc.m +++ b/Tools/gdnc.m @@ -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"