Use new RunLoop mechanism, and new Array method names.

([Server -connection:didConnect:]): Clean up search for invalidated
proxies.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1229 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1996-03-19 20:52:25 +00:00
parent a69d1025ed
commit b32ebc500b

View file

@ -5,6 +5,7 @@
#include <objects/Connection.h> #include <objects/Connection.h>
#include <objects/String.h> #include <objects/String.h>
#include <objects/Notification.h> #include <objects/Notification.h>
#include <objects/RunLoop.h>
#include "server.h" #include "server.h"
@implementation Server @implementation Server
@ -23,7 +24,7 @@
} }
- objectAt: (unsigned)i - objectAt: (unsigned)i
{ {
return [the_array objectAt:i]; return [the_array objectAtIndex: i];
} }
- print: (const char *)msg - print: (const char *)msg
{ {
@ -162,22 +163,20 @@
return d; return d;
} }
- senderIsInvalid: anObj - connectionBecameInvalid: notification
{ {
id anObj = [notification object];
if ([anObj isKindOf:[Connection class]]) if ([anObj isKindOf:[Connection class]])
{ {
id objList; int i, count = [the_array count];
int i, j, count, listCount = [the_array count]; for (i = count-1; i >= 0; i--)
objList = [anObj proxies]; {
count = [objList count]; id o = [the_array objectAtIndex: i];
/* This contortion avoids List's calling -isEqual: on the proxy */ if ([o isProxy] && [o connectionForProxy] == anObj)
for (i = 0; i < count; i++) [the_array removeObjectAtIndex: i];
for (j = 0; j < [the_array count]; j++) }
if ([the_array objectAt:j] == [objList objectAtIndex:i]) if (count != [the_array count])
[the_array removeObjectAtIndex: j]; printf("$$$$$ connectionBecameInvalid: removed from the_array\n");
[objList release];
if (listCount != [the_array count])
printf("$$$$$ senderIsInvalid: removed from the_array\n");
} }
else else
{ {
@ -228,7 +227,8 @@ int main(int argc, char *argv[])
printf("got double %f\n", d); printf("got double %f\n", d);
printf("list's hash is 0x%x\n", (unsigned)[l hash]); printf("list's hash is 0x%x\n", (unsigned)[l hash]);
printf("object's hash is 0x%x\n", (unsigned)[o hash]); printf("object's hash is 0x%x\n", (unsigned)[o hash]);
[c runConnection];
[RunLoop run];
exit(0); exit(0);
} }