This is NSDistantObjectExtras.m in view mode; [Download] [Up]
// NSDistantObjectExtras.m
#import "NSDistantObjectExtras.h"
#import <Foundation/Foundation.h>
@implementation NSDistantObject (Extras)
static NSMutableSet * connectionsCreated = nil;
- (NSDistantObject *) proxyWithProperConnection {
NSPort * rcvPort = [[NSConnection defaultConnection] receivePort];
if (rcvPort != [conn receivePort]) {
NSConnection * priConn = [NSConnection connectionWithReceivePort:rcvPort
sendPort:[conn sendPort]];
if (!connectionsCreated)
connectionsCreated = [NSMutableSet new];
[connectionsCreated addObject: priConn];
// use some reasonable default timeouts
[priConn setRequestTimeout: 45.0];
[priConn setReplyTimeout: 45.0];
// it is never clear when it is safe to release these proxies we dole out
return [[NSDistantObject alloc] initWithTarget:(id)name connection:priConn];
}
return self;
}
- (BOOL) isEqualInSameTask: (NSDistantObject *) other {
return (name == other->name) ? YES : NO;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.