More message port work.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21986 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-11-11 10:07:03 +00:00
parent e848a285c4
commit 50969bf11d
4 changed files with 41 additions and 13 deletions

View file

@ -1,3 +1,21 @@
2005-11-11 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <rfm@gnu.org>
* 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 <rfm@gnu.org> 2005-11-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/win32/NSMessagePortWin32.m: more changes * Source/win32/NSMessagePortWin32.m: more changes

View file

@ -206,18 +206,26 @@ static void clean_up_names(void)
{ {
NSString *n; NSString *n;
NSDebugLLog(@"NSMessagePort", @"portForName: %@ host: %@", name, host); NSDebugLLog(@"NSMessagePortNameServer",
@"portForName: %@ host: %@", name, host);
if ([host length] && ![host isEqual: @"*"]) if ([host length] && ![host isEqual: @"*"])
{ {
NSDebugLLog(@"NSMessagePort", @"non-local host"); NSDebugLLog(@"NSMessagePortNameServer", @"non-local host");
return nil; return nil;
} }
n = [[self class] _query: name]; n = [[self class] _query: name];
if (n == nil)
NSDebugLLog(@"NSMessagePort", @"got %@", n); {
NSDebugLLog(@"NSMessagePortNameServer", @"got no port for %@", name);
return nil;
}
else
{
NSDebugLLog(@"NSMessagePortNameServer", @"got %@ for %@", n, name);
return AUTORELEASE([NSMessagePort newWithName: n]); return AUTORELEASE([NSMessagePort newWithName: n]);
}
} }
- (BOOL) registerPort: (NSPort *)port - (BOOL) registerPort: (NSPort *)port
@ -227,7 +235,7 @@ static void clean_up_names(void)
NSString *n; NSString *n;
int rc; int rc;
NSDebugLLog(@"NSMessagePort", @"register %@ as %@\n", port, name); NSDebugLLog(@"NSMessagePortNameServer", @"register %@ as %@\n", port, name);
if ([port isKindOfClass: [NSMessagePort class]] == NO) if ([port isKindOfClass: [NSMessagePort class]] == NO)
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
@ -238,7 +246,7 @@ static void clean_up_names(void)
if ([[self class] _query: name] != nil) if ([[self class] _query: name] != nil)
{ {
NSDebugLLog(@"NSMessagePort", @"fail, is a live port"); NSDebugLLog(@"NSMessagePortNameServer", @"fail, is a live port");
return NO; return NO;
} }
@ -286,7 +294,7 @@ static void clean_up_names(void)
NSString *n; NSString *n;
int rc; int rc;
NSDebugLLog(@"NSMessagePort", @"removePortForName: %@", name); NSDebugLLog(@"NSMessagePortNameServer", @"removePortForName: %@", name);
n = [[self class] _translate: name]; n = [[self class] _translate: name];
rc = RegDeleteValueW(key, UNISTR(n)); rc = RegDeleteValueW(key, UNISTR(n));
@ -309,7 +317,7 @@ static void clean_up_names(void)
NSMutableArray *a; NSMutableArray *a;
int i; int i;
NSDebugLLog(@"NSMessagePort", @"removePort: %@", port); NSDebugLLog(@"NSMessagePortNameServer", @"removePort: %@", port);
[serverLock lock]; [serverLock lock];
a = NSMapGet(portToNamesMap, port); a = NSMapGet(portToNamesMap, port);
@ -327,7 +335,8 @@ static void clean_up_names(void)
- (BOOL) removePort: (NSPort*)port forName: (NSString*)name - (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) if ([self portForName: name onHost: @""] == port)
{ {

View file

@ -772,8 +772,6 @@ static unsigned wordAlign;
M_LOCK(this->lock); M_LOCK(this->lock);
retry:
if (this->wData != nil) if (this->wData != nil)
{ {
/* /*
@ -830,7 +828,7 @@ retry:
{ {
NSDebugMLLog(@"NSMessagePort", @"Write of %d performs %d", NSDebugMLLog(@"NSMessagePort", @"Write of %d performs %d",
[this->wData length] - this->wLength, this->wSize); [this->wData length] - this->wLength, this->wSize);
goto retry; SetEvent(this->wEvent);
} }
else if ((errno = GetLastError()) != ERROR_IO_PENDING) else if ((errno = GetLastError()) != ERROR_IO_PENDING)
{ {

View file

@ -211,6 +211,7 @@ int con_data (id prx)
printf(" got %x\n", small.z); printf(" got %x\n", small.z);
[pool release]; [pool release];
#if !defined(__MINGW32__)
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
printf("Struct:\n"); printf("Struct:\n");
printf(" sending c='%c',d=%g,i=%d,s=%s,l=%ld", 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", printf(" got c='%c',d=%g,i=%d,s=%s,l=%ld\n",
ffoo.c, ffoo.d, ffoo.i, ffoo.s, ffoo.l); ffoo.c, ffoo.d, ffoo.i, ffoo.s, ffoo.l);
[pool release]; [pool release];
#endif
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
printf("Object:\n"); printf("Object:\n");
@ -511,6 +513,7 @@ int main (int argc, char *argv[], char **env)
auth = [Auth new]; auth = [Auth new];
GSDebugAllocationActive(YES); GSDebugAllocationActive(YES);
setvbuf(stdout, 0, _IONBF, 0);
debug = 0; debug = 0;
type_test = 0; type_test = 0;
stats = 0; stats = 0;