diff --git a/ChangeLog b/ChangeLog index d7ac1b22c..e3c379f88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-11-10 Richard Frith-Macdonald + + * Source/GSTcpPort.m: Added some locking tweaks for writing data. + * Source/GSString.m: Fix for decoding obsolete string classes. + 2000-11-09 Richard Frith-Macdonald * Source/NSPort.m: ([-setDelegate:]) corrected assertion to allow diff --git a/Source/GSString.m b/Source/GSString.m index 5fcbcf665..f9dd10dd3 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -2935,8 +2935,9 @@ transmute(ivars self, NSString *aString) { unsigned count; + NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class])); RELEASE(self); - self = (id)NSAllocateObject(GSCStringClass, 0, GSObjCZone(self)); + self = (id)NSAllocateObject(GSCStringClass, 0, NSDefaultMallocZone()); [aCoder decodeValueOfObjCType: @encode(unsigned) at: &count]; if (count > 0) { @@ -2965,8 +2966,9 @@ transmute(ivars self, NSString *aString) { unsigned count; + NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class])); RELEASE(self); - self = (id)NSAllocateObject(GSMutableStringClass, 0, GSObjCZone(self)); + self = (id)NSAllocateObject(GSMutableStringClass, 0, NSDefaultMallocZone()); [aCoder decodeValueOfObjCType: @encode(unsigned) at: &count]; if (count > 0) { @@ -2995,8 +2997,9 @@ transmute(ivars self, NSString *aString) { unsigned count; + NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class])); RELEASE(self); - self = (id)NSAllocateObject(GSUnicodeStringClass, 0, GSObjCZone(self)); + self = (id)NSAllocateObject(GSUnicodeStringClass, 0, NSDefaultMallocZone()); [aCoder decodeValueOfObjCType: @encode(unsigned) at: &count]; if (count > 0) { @@ -3025,8 +3028,9 @@ transmute(ivars self, NSString *aString) { unsigned count; + NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class])); RELEASE(self); - self = (id)NSAllocateObject(GSMutableStringClass, 0, GSObjCZone(self)); + self = (id)NSAllocateObject(GSMutableStringClass, 0, NSDefaultMallocZone()); [aCoder decodeValueOfObjCType: @encode(unsigned) at: &count]; if (count > 0) { diff --git a/Source/GSTcpPort.m b/Source/GSTcpPort.m index 7ba56adf0..56bdc3149 100644 --- a/Source/GSTcpPort.m +++ b/Source/GSTcpPort.m @@ -720,7 +720,6 @@ static Class runLoopClass; NSDebugMLLog(@"GSTcpHandle", @"read %d bytes", res); rLength += res; - while (valid == YES && rLength >= rWant) { switch (rType) @@ -1004,12 +1003,14 @@ static Class runLoopClass; } b = [wData bytes]; l = [wData length]; +DO_LOCK(myLock); res = write(desc, b + wLength, l - wLength); if (res < 0) { if (errno != EINTR && errno != EAGAIN) { NSLog(@"write attempt failed - %s", strerror(errno)); +DO_UNLOCK(myLock); [self invalidate]; return; } @@ -1056,6 +1057,7 @@ static Class runLoopClass; } } } +DO_UNLOCK(myLock); } } } diff --git a/Testing/nsconnection_client.m b/Testing/nsconnection_client.m index ef2003b74..bfc907b9c 100644 --- a/Testing/nsconnection_client.m +++ b/Testing/nsconnection_client.m @@ -328,11 +328,12 @@ usage(const char *program) printf(" -m - Messaging test\n"); printf(" -l - Loop test\n"); printf(" -o - Objects test\n"); + printf(" -c - Connect test\n"); } typedef enum { NO_TEST, TYPE_TEST, BENCHMARK_TEST, MESSAGE_TEST, - LOOP_TEST, OBJECT_TEST + LOOP_TEST, OBJECT_TEST, CONNECT_TEST } test_t; int main (int argc, char *argv[], char **env) @@ -340,6 +341,7 @@ int main (int argc, char *argv[], char **env) int c, debug, stats; test_t type_test; id cobj, prx; + unsigned connect_attempts; NSAutoreleasePool *arp; Auth *auth; #ifndef __MINGW__ @@ -355,7 +357,7 @@ int main (int argc, char *argv[], char **env) debug = 0; type_test = 0; stats = 0; - while ((c = getopt(argc, argv, "hdtbmslo")) != EOF) + while ((c = getopt(argc, argv, "hdtbmsloc")) != EOF) switch (c) { case 'd': @@ -379,6 +381,9 @@ int main (int argc, char *argv[], char **env) case 'o': type_test = OBJECT_TEST; break; + case 'c': + type_test = CONNECT_TEST; + break; case 'h': usage(argv[0]); exit(0); @@ -398,25 +403,42 @@ int main (int argc, char *argv[], char **env) //[NSPort setDebug: 10]; } - if (optind < argc) + if (type_test == CONNECT_TEST) + connect_attempts = 100000; + else + connect_attempts = 1; + + while (connect_attempts-- > 0) { - if (optind+1 < argc) - prx = [NSConnection rootProxyForConnectionWithRegisteredName: - [NSString stringWithCString: argv[optind+1]] - host: [NSString stringWithCString:argv[optind]]]; + if (optind < argc) + { + if (optind+1 < argc) + prx = [NSConnection rootProxyForConnectionWithRegisteredName: + [NSString stringWithCString: argv[optind+1]] + host: [NSString stringWithCString:argv[optind]]]; + else + prx = [NSConnection rootProxyForConnectionWithRegisteredName: + @"test2server" + host:[NSString stringWithCString:argv[optind]]]; + } else prx = [NSConnection rootProxyForConnectionWithRegisteredName: - @"test2server" - host:[NSString stringWithCString:argv[optind]]]; - } - else - prx = [NSConnection rootProxyForConnectionWithRegisteredName:@"test2server" - host:nil]; - - if (prx == nil) - { - printf("ERROR: Failed to connect to server\n"); - return -1; + @"test2server" + host:nil]; + if (prx == nil) + { + printf("ERROR: Failed to connect to server\n"); + return -1; + } + if (type_test == CONNECT_TEST) + { + NSLog(@"Made connection\n"); + if (connect_attempts > 0) + { + RELEASE(arp); + arp = [NSAutoreleasePool new]; + } + } } cobj = [prx connectionForProxy];