From 50969bf11d9444249d793210e6c8eb6fa83db8db Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 11 Nov 2005 10:07:03 +0000 Subject: [PATCH] More message port work. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21986 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 18 +++++++++++++ Source/win32/NSMessagePortNameServerWin32.m | 29 ++++++++++++++------- Source/win32/NSMessagePortWin32.m | 4 +-- Testing/nsconnection_client.m | 3 +++ 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d9cbd330..7ce6d5a42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2005-11-11 Richard Frith-Macdonald + + * Source/win32/NSMessagePortNameServerWin32.m: fix port lookup in case + where named port does not exist. Correct debug logging by class name. + * Testing/nsconnection_client.m: don't run large structure test on + mingw32 at present ... it crashes (something wrong with the invocation + stuff for ffcall and some large structures on mingw32) + +2005-11-10 Richard Frith-Macdonald + + * Source/win32/NSMessagePortWin32.m: more changes + * Source/win32/NSMessagePortNameServerWin32.m: ditto + Working at least in part (pre-alpha I guess) ... enable with the + GSMailslot user default. Known problems - + 1. no way of telling if the other end of a connection has gone until + we try to write to it. + 2. hangup in my testing comms between three threads. + 2005-11-09 Richard Frith-Macdonald * Source/win32/NSMessagePortWin32.m: more changes diff --git a/Source/win32/NSMessagePortNameServerWin32.m b/Source/win32/NSMessagePortNameServerWin32.m index 067470274..a7b899aca 100644 --- a/Source/win32/NSMessagePortNameServerWin32.m +++ b/Source/win32/NSMessagePortNameServerWin32.m @@ -206,18 +206,26 @@ static void clean_up_names(void) { NSString *n; - NSDebugLLog(@"NSMessagePort", @"portForName: %@ host: %@", name, host); + NSDebugLLog(@"NSMessagePortNameServer", + @"portForName: %@ host: %@", name, host); if ([host length] && ![host isEqual: @"*"]) { - NSDebugLLog(@"NSMessagePort", @"non-local host"); + NSDebugLLog(@"NSMessagePortNameServer", @"non-local host"); return nil; } n = [[self class] _query: name]; - - NSDebugLLog(@"NSMessagePort", @"got %@", n); - return AUTORELEASE([NSMessagePort newWithName: n]); + if (n == nil) + { + NSDebugLLog(@"NSMessagePortNameServer", @"got no port for %@", name); + return nil; + } + else + { + NSDebugLLog(@"NSMessagePortNameServer", @"got %@ for %@", n, name); + return AUTORELEASE([NSMessagePort newWithName: n]); + } } - (BOOL) registerPort: (NSPort *)port @@ -227,7 +235,7 @@ static void clean_up_names(void) NSString *n; int rc; - NSDebugLLog(@"NSMessagePort", @"register %@ as %@\n", port, name); + NSDebugLLog(@"NSMessagePortNameServer", @"register %@ as %@\n", port, name); if ([port isKindOfClass: [NSMessagePort class]] == NO) { [NSException raise: NSInvalidArgumentException @@ -238,7 +246,7 @@ static void clean_up_names(void) if ([[self class] _query: name] != nil) { - NSDebugLLog(@"NSMessagePort", @"fail, is a live port"); + NSDebugLLog(@"NSMessagePortNameServer", @"fail, is a live port"); return NO; } @@ -286,7 +294,7 @@ static void clean_up_names(void) NSString *n; int rc; - NSDebugLLog(@"NSMessagePort", @"removePortForName: %@", name); + NSDebugLLog(@"NSMessagePortNameServer", @"removePortForName: %@", name); n = [[self class] _translate: name]; rc = RegDeleteValueW(key, UNISTR(n)); @@ -309,7 +317,7 @@ static void clean_up_names(void) NSMutableArray *a; int i; - NSDebugLLog(@"NSMessagePort", @"removePort: %@", port); + NSDebugLLog(@"NSMessagePortNameServer", @"removePort: %@", port); [serverLock lock]; a = NSMapGet(portToNamesMap, port); @@ -327,7 +335,8 @@ static void clean_up_names(void) - (BOOL) removePort: (NSPort*)port forName: (NSString*)name { - NSDebugLLog(@"NSMessagePort", @"removePort: %@ forName: %@", port, name); + NSDebugLLog(@"NSMessagePortNameServer", + @"removePort: %@ forName: %@", port, name); if ([self portForName: name onHost: @""] == port) { diff --git a/Source/win32/NSMessagePortWin32.m b/Source/win32/NSMessagePortWin32.m index 5163f3d62..ce8f4a3c8 100644 --- a/Source/win32/NSMessagePortWin32.m +++ b/Source/win32/NSMessagePortWin32.m @@ -772,8 +772,6 @@ static unsigned wordAlign; M_LOCK(this->lock); -retry: - if (this->wData != nil) { /* @@ -830,7 +828,7 @@ retry: { NSDebugMLLog(@"NSMessagePort", @"Write of %d performs %d", [this->wData length] - this->wLength, this->wSize); - goto retry; + SetEvent(this->wEvent); } else if ((errno = GetLastError()) != ERROR_IO_PENDING) { diff --git a/Testing/nsconnection_client.m b/Testing/nsconnection_client.m index 9149c8461..2312f30cd 100644 --- a/Testing/nsconnection_client.m +++ b/Testing/nsconnection_client.m @@ -211,6 +211,7 @@ int con_data (id prx) printf(" got %x\n", small.z); [pool release]; +#if !defined(__MINGW32__) pool = [NSAutoreleasePool new]; printf("Struct:\n"); printf(" sending c='%c',d=%g,i=%d,s=%s,l=%ld", @@ -224,6 +225,7 @@ int con_data (id prx) printf(" got c='%c',d=%g,i=%d,s=%s,l=%ld\n", ffoo.c, ffoo.d, ffoo.i, ffoo.s, ffoo.l); [pool release]; +#endif pool = [NSAutoreleasePool new]; printf("Object:\n"); @@ -511,6 +513,7 @@ int main (int argc, char *argv[], char **env) auth = [Auth new]; GSDebugAllocationActive(YES); + setvbuf(stdout, 0, _IONBF, 0); debug = 0; type_test = 0; stats = 0;