mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
DO and encoding updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6861 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
656fde90c0
commit
dae20769ac
12 changed files with 285 additions and 204 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2000-07-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSConnection.m: Implementation almost complete
|
||||||
|
* Source/GSPortCoder.m: Completed
|
||||||
|
* Source/GSTcpPort.m: tidied for MacOS-X compatibility
|
||||||
|
* Source/NSArchiver.m: Bugfix encoding structures containing arrays
|
||||||
|
* Source/NSData.m: minor tidy
|
||||||
|
* Source/NSDistantObject.m: update for new implementation
|
||||||
|
* Source/NSInvocation.m: bugfix decoding
|
||||||
|
* Source/NSPort.m: update for MacOS-X complience
|
||||||
|
* Source/NSPortNameServer.m: tidied
|
||||||
|
* Testing/client.m: Update
|
||||||
|
* Testing/server.m: update
|
||||||
|
|
||||||
2000-06-30 Adam Fedor <fedor@gnu.org>
|
2000-06-30 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
libgstep-base now compiles (and links) into a DLL on Cygwin.
|
libgstep-base now compiles (and links) into a DLL on Cygwin.
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include <mframe.h>
|
#include <mframe.h>
|
||||||
|
|
||||||
#include <Foundation/GSConnection.h>
|
#include <Foundation/GSConnection.h>
|
||||||
#include <Foundation/DistributedObjects.h>
|
|
||||||
#include <Foundation/GSPortCoder.h>
|
#include <Foundation/GSPortCoder.h>
|
||||||
#include <Foundation/GSConnection.h>
|
#include <Foundation/DistributedObjects.h>
|
||||||
|
|
||||||
#include <Foundation/NSHashTable.h>
|
#include <Foundation/NSHashTable.h>
|
||||||
#include <Foundation/NSMapTable.h>
|
#include <Foundation/NSMapTable.h>
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
|
@ -49,6 +49,12 @@
|
||||||
#include <Foundation/NSPortMessage.h>
|
#include <Foundation/NSPortMessage.h>
|
||||||
#include <Foundation/NSPortNameServer.h>
|
#include <Foundation/NSPortNameServer.h>
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
|
||||||
|
#define F_LOCK(X) {NSDebugFLLog(@"GSConnection",@"Lock %@",X);[X lock];}
|
||||||
|
#define F_UNLOCK(X) {NSDebugFLLog(@"GSConnection",@"Unlock %@",X);[X unlock];}
|
||||||
|
#define M_LOCK(X) {NSDebugMLLog(@"GSConnection",@"Lock %@",X);[X lock];}
|
||||||
|
#define M_UNLOCK(X) {NSDebugMLLog(@"GSConnection",@"Unlock %@",X);[X unlock];}
|
||||||
|
|
||||||
static NSString*
|
static NSString*
|
||||||
stringFromMsgType(int type)
|
stringFromMsgType(int type)
|
||||||
|
@ -231,7 +237,7 @@ existingConnection(NSPort *receivePort, NSPort *sendPort)
|
||||||
NSHashEnumerator enumerator;
|
NSHashEnumerator enumerator;
|
||||||
NSConnection *c;
|
NSConnection *c;
|
||||||
|
|
||||||
[connection_table_gate lock];
|
F_LOCK(connection_table_gate);
|
||||||
enumerator = NSEnumerateHashTable(connection_table);
|
enumerator = NSEnumerateHashTable(connection_table);
|
||||||
while ((c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
|
while ((c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
|
||||||
{
|
{
|
||||||
|
@ -246,7 +252,7 @@ existingConnection(NSPort *receivePort, NSPort *sendPort)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[connection_table_gate unlock];
|
F_UNLOCK(connection_table_gate);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,9 +264,9 @@ rootObjectForInPort(NSPort *aPort)
|
||||||
{
|
{
|
||||||
id rootObject;
|
id rootObject;
|
||||||
|
|
||||||
[root_object_map_gate lock];
|
F_LOCK(root_object_map_gate);
|
||||||
rootObject = (id)NSMapGet(root_object_map, (void*)(gsaddr)aPort);
|
rootObject = (id)NSMapGet(root_object_map, (void*)(gsaddr)aPort);
|
||||||
[root_object_map_gate unlock];
|
F_UNLOCK(root_object_map_gate);
|
||||||
return rootObject;
|
return rootObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ setRootObjectForInPort(id anObj, NSPort *aPort)
|
||||||
{
|
{
|
||||||
id oldRootObject;
|
id oldRootObject;
|
||||||
|
|
||||||
[root_object_map_gate lock];
|
F_LOCK(root_object_map_gate);
|
||||||
oldRootObject = (id)NSMapGet(root_object_map, (void*)(gsaddr)aPort);
|
oldRootObject = (id)NSMapGet(root_object_map, (void*)(gsaddr)aPort);
|
||||||
if (oldRootObject != anObj)
|
if (oldRootObject != anObj)
|
||||||
{
|
{
|
||||||
|
@ -284,7 +290,7 @@ setRootObjectForInPort(id anObj, NSPort *aPort)
|
||||||
NSMapRemove(root_object_map, (void*)(gsaddr)aPort);
|
NSMapRemove(root_object_map, (void*)(gsaddr)aPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[root_object_map_gate unlock];
|
F_UNLOCK(root_object_map_gate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSMapTable *all_connections_local_objects = NULL;
|
static NSMapTable *all_connections_local_objects = NULL;
|
||||||
|
@ -318,7 +324,7 @@ static int messages_received_count;
|
||||||
if (c == nil)
|
if (c == nil)
|
||||||
{
|
{
|
||||||
c = [self allocWithZone: NSDefaultMallocZone()];
|
c = [self allocWithZone: NSDefaultMallocZone()];
|
||||||
c = [self initWithReceivePort: r sendPort: s];
|
c = [c initWithReceivePort: r sendPort: s];
|
||||||
AUTORELEASE(c);
|
AUTORELEASE(c);
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
|
@ -496,7 +502,7 @@ static int messages_received_count;
|
||||||
|
|
||||||
- (void) addRequestMode: (NSString*)mode
|
- (void) addRequestMode: (NSString*)mode
|
||||||
{
|
{
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
if ([self isValid] == YES)
|
if ([self isValid] == YES)
|
||||||
{
|
{
|
||||||
if ([_requestModes containsObject: mode] == NO)
|
if ([_requestModes containsObject: mode] == NO)
|
||||||
|
@ -512,12 +518,12 @@ static int messages_received_count;
|
||||||
[_requestModes addObject: mode];
|
[_requestModes addObject: mode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) addRunLoop: (NSRunLoop*)loop
|
- (void) addRunLoop: (NSRunLoop*)loop
|
||||||
{
|
{
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
if ([self isValid] == YES)
|
if ([self isValid] == YES)
|
||||||
{
|
{
|
||||||
if ([_runLoops indexOfObjectIdenticalTo: loop] == NSNotFound)
|
if ([_runLoops indexOfObjectIdenticalTo: loop] == NSNotFound)
|
||||||
|
@ -533,7 +539,7 @@ static int messages_received_count;
|
||||||
[_runLoops addObject: loop];
|
[_runLoops addObject: loop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -600,18 +606,16 @@ static int messages_received_count;
|
||||||
s = r;
|
s = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
[connection_table_gate lock];
|
conn = existingConnection(r, s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the send and receive ports match an existing connection
|
* If the send and receive ports match an existing connection
|
||||||
* deallocate the new one and retain and return the old one.
|
* deallocate the new one and retain and return the old one.
|
||||||
*/
|
*/
|
||||||
conn = existingConnection(r, s);
|
|
||||||
if (conn != nil)
|
if (conn != nil)
|
||||||
{
|
{
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
self = RETAIN(conn);
|
self = RETAIN(conn);
|
||||||
[connection_table_gate unlock];
|
|
||||||
if (debug_connection > 2)
|
if (debug_connection > 2)
|
||||||
{
|
{
|
||||||
NSLog(@"Found existing connection (0x%x) for \n\t%@\n\t%@",
|
NSLog(@"Found existing connection (0x%x) for \n\t%@\n\t%@",
|
||||||
|
@ -620,11 +624,20 @@ static int messages_received_count;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The parent connection is the one whose send and receive ports are
|
||||||
|
* both the same as our receive port.
|
||||||
|
*/
|
||||||
|
parent = existingConnection(r, r);
|
||||||
|
|
||||||
if (debug_connection)
|
if (debug_connection)
|
||||||
{
|
{
|
||||||
NSLog(@"Initialising new connection 0x%x\n\t%@\n\t%@",
|
NSLog(@"Initialising new connection with parent 0x%x, 0x%x\n\t%@\n\t%@",
|
||||||
(gsaddr)self, r, s);
|
(gsaddr)parent, (gsaddr)self, r, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M_LOCK(connection_table_gate);
|
||||||
|
|
||||||
_isValid = YES;
|
_isValid = YES;
|
||||||
_receivePort = RETAIN(r);
|
_receivePort = RETAIN(r);
|
||||||
_sendPort = RETAIN(s);
|
_sendPort = RETAIN(s);
|
||||||
|
@ -674,7 +687,6 @@ static int messages_received_count;
|
||||||
/*
|
/*
|
||||||
* Some attributes are inherited from the parent if possible.
|
* Some attributes are inherited from the parent if possible.
|
||||||
*/
|
*/
|
||||||
parent = existingConnection(r, r);
|
|
||||||
if (parent != nil)
|
if (parent != nil)
|
||||||
{
|
{
|
||||||
_independentQueueing = parent->_independentQueueing;
|
_independentQueueing = parent->_independentQueueing;
|
||||||
|
@ -710,7 +722,7 @@ static int messages_received_count;
|
||||||
{
|
{
|
||||||
if ([del connection: parent shouldMakeNewConnection: self] == NO)
|
if ([del connection: parent shouldMakeNewConnection: self] == NO)
|
||||||
{
|
{
|
||||||
[connection_table_gate unlock];
|
M_UNLOCK(connection_table_gate);
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -720,7 +732,7 @@ static int messages_received_count;
|
||||||
{
|
{
|
||||||
if (![del makeNewConnection: self sender: parent])
|
if (![del makeNewConnection: self sender: parent])
|
||||||
{
|
{
|
||||||
[connection_table_gate unlock];
|
M_UNLOCK(connection_table_gate);
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -731,6 +743,15 @@ static int messages_received_count;
|
||||||
if ([del respondsTo: @selector(connection:didConnect:)])
|
if ([del respondsTo: @selector(connection:didConnect:)])
|
||||||
self = [del connection: parent didConnect: self];
|
self = [del connection: parent didConnect: self];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we have no parent, we must handle incoming packets on our
|
||||||
|
* receive port ourself - so we set ourself up as the port delegate.
|
||||||
|
*/
|
||||||
|
if (parent == nil)
|
||||||
|
{
|
||||||
|
[_receivePort setDelegate: self];
|
||||||
|
}
|
||||||
|
|
||||||
/* Register ourselves for invalidation notification when the
|
/* Register ourselves for invalidation notification when the
|
||||||
ports become invalid. */
|
ports become invalid. */
|
||||||
nCenter = [NSNotificationCenter defaultCenter];
|
nCenter = [NSNotificationCenter defaultCenter];
|
||||||
|
@ -748,7 +769,7 @@ static int messages_received_count;
|
||||||
implementation of [-release] to automatically remove the connection
|
implementation of [-release] to automatically remove the connection
|
||||||
from this array when it is the only thing retaining it. */
|
from this array when it is the only thing retaining it. */
|
||||||
NSHashInsert(connection_table, (void*)self);
|
NSHashInsert(connection_table, (void*)self);
|
||||||
[connection_table_gate unlock];
|
M_UNLOCK(connection_table_gate);
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSConnectionDidInitializeNotification
|
postNotificationName: NSConnectionDidInitializeNotification
|
||||||
|
@ -761,10 +782,10 @@ static int messages_received_count;
|
||||||
{
|
{
|
||||||
BOOL wasValid;
|
BOOL wasValid;
|
||||||
|
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
wasValid = _isValid;
|
wasValid = _isValid;
|
||||||
_isValid = NO;
|
_isValid = NO;
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
|
|
||||||
if (wasValid == NO)
|
if (wasValid == NO)
|
||||||
{
|
{
|
||||||
|
@ -814,7 +835,7 @@ static int messages_received_count;
|
||||||
NSArray *targets;
|
NSArray *targets;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
targets = NSAllMapTableValues(_localTargets);
|
targets = NSAllMapTableValues(_localTargets);
|
||||||
IF_NO_GC(RETAIN(targets));
|
IF_NO_GC(RETAIN(targets));
|
||||||
for (i = 0; i < [targets count]; i++)
|
for (i = 0; i < [targets count]; i++)
|
||||||
|
@ -824,7 +845,7 @@ static int messages_received_count;
|
||||||
[self removeLocalObject: t];
|
[self removeLocalObject: t];
|
||||||
}
|
}
|
||||||
[targets release];
|
[targets release];
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
|
@ -840,9 +861,9 @@ static int messages_received_count;
|
||||||
NSArray *c;
|
NSArray *c;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
c = NSAllMapTableValues(_localObjects);
|
c = NSAllMapTableValues(_localObjects);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,15 +934,15 @@ static int messages_received_count;
|
||||||
NSArray *c;
|
NSArray *c;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
c = NSAllMapTableValues(_remoteProxies);
|
c = NSAllMapTableValues(_remoteProxies);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeRequestMode: (NSString*)mode
|
- (void) removeRequestMode: (NSString*)mode
|
||||||
{
|
{
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
if ([_requestModes containsObject: mode])
|
if ([_requestModes containsObject: mode])
|
||||||
{
|
{
|
||||||
unsigned c = [_runLoops count];
|
unsigned c = [_runLoops count];
|
||||||
|
@ -934,14 +955,14 @@ static int messages_received_count;
|
||||||
}
|
}
|
||||||
[_requestModes removeObject: mode];
|
[_requestModes removeObject: mode];
|
||||||
}
|
}
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeRunLoop: (NSRunLoop*)loop
|
- (void) removeRunLoop: (NSRunLoop*)loop
|
||||||
{
|
{
|
||||||
unsigned pos;
|
unsigned pos;
|
||||||
|
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
pos = [_runLoops indexOfObjectIdenticalTo: loop];
|
pos = [_runLoops indexOfObjectIdenticalTo: loop];
|
||||||
if (pos != NSNotFound)
|
if (pos != NSNotFound)
|
||||||
{
|
{
|
||||||
|
@ -955,7 +976,7 @@ static int messages_received_count;
|
||||||
}
|
}
|
||||||
[_runLoops removeObjectAtIndex: pos];
|
[_runLoops removeObjectAtIndex: pos];
|
||||||
}
|
}
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTimeInterval) replyTimeout
|
- (NSTimeInterval) replyTimeout
|
||||||
|
@ -1028,7 +1049,7 @@ static int messages_received_count;
|
||||||
|
|
||||||
- (void) setRequestMode: (NSString*)mode
|
- (void) setRequestMode: (NSString*)mode
|
||||||
{
|
{
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
while ([_requestModes count] > 0 && [_requestModes objectAtIndex: 0] != mode)
|
while ([_requestModes count] > 0 && [_requestModes objectAtIndex: 0] != mode)
|
||||||
{
|
{
|
||||||
[self removeRequestMode: [_requestModes objectAtIndex: 0]];
|
[self removeRequestMode: [_requestModes objectAtIndex: 0]];
|
||||||
|
@ -1041,7 +1062,7 @@ static int messages_received_count;
|
||||||
{
|
{
|
||||||
[self addRequestMode: mode];
|
[self addRequestMode: mode];
|
||||||
}
|
}
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setRequestTimeout: (NSTimeInterval)to
|
- (void) setRequestTimeout: (NSTimeInterval)to
|
||||||
|
@ -1061,7 +1082,7 @@ static int messages_received_count;
|
||||||
|
|
||||||
d = [NSMutableDictionary dictionaryWithCapacity: 8];
|
d = [NSMutableDictionary dictionaryWithCapacity: 8];
|
||||||
|
|
||||||
[_refGate lock];
|
M_LOCK(_refGate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are in OPENSTEP 4.2
|
* These are in OPENSTEP 4.2
|
||||||
|
@ -1082,12 +1103,12 @@ static int messages_received_count;
|
||||||
[d setObject: o forKey: NSConnectionLocalCount];
|
[d setObject: o forKey: NSConnectionLocalCount];
|
||||||
o = [NSNumber numberWithUnsignedInt: NSCountMapTable(_remoteProxies)];
|
o = [NSNumber numberWithUnsignedInt: NSCountMapTable(_remoteProxies)];
|
||||||
[d setObject: o forKey: NSConnectionProxyCount];
|
[d setObject: o forKey: NSConnectionProxyCount];
|
||||||
[received_request_rmc_queue_gate lock];
|
M_LOCK(received_request_rmc_queue_gate);
|
||||||
o = [NSNumber numberWithUnsignedInt: [received_request_rmc_queue count]];
|
o = [NSNumber numberWithUnsignedInt: [received_request_rmc_queue count]];
|
||||||
[received_request_rmc_queue_gate unlock];
|
M_UNLOCK(received_request_rmc_queue_gate);
|
||||||
[d setObject: o forKey: @"Pending packets"];
|
[d setObject: o forKey: @"Pending packets"];
|
||||||
|
|
||||||
[_refGate unlock];
|
M_UNLOCK(_refGate);
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -1106,11 +1127,11 @@ static int messages_received_count;
|
||||||
NSLog(@"finalising 0x%x", (gsaddr)self);
|
NSLog(@"finalising 0x%x", (gsaddr)self);
|
||||||
|
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
[connection_table_gate lock];
|
M_LOCK(connection_table_gate);
|
||||||
NSHashRemove(connection_table, self);
|
NSHashRemove(connection_table, self);
|
||||||
[timer invalidate];
|
[timer invalidate];
|
||||||
timer = nil;
|
timer = nil;
|
||||||
[connection_table_gate unlock];
|
M_UNLOCK(connection_table_gate);
|
||||||
|
|
||||||
/* Remove rootObject from root_object_map if this is last connection */
|
/* Remove rootObject from root_object_map if this is last connection */
|
||||||
if (_receivePort != nil && existingConnection(_receivePort, nil) == nil)
|
if (_receivePort != nil && existingConnection(_receivePort, nil) == nil)
|
||||||
|
@ -1124,11 +1145,24 @@ static int messages_received_count;
|
||||||
DESTROY(_requestModes);
|
DESTROY(_requestModes);
|
||||||
DESTROY(_runLoops);
|
DESTROY(_runLoops);
|
||||||
|
|
||||||
/* Finished with ports - releasing them may generate a notification */
|
/*
|
||||||
|
* Finished with ports - releasing them may generate a notification
|
||||||
|
* If we are the receive port delagate, try to shift responsibility.
|
||||||
|
*/
|
||||||
|
if ([_receivePort delegate] == self)
|
||||||
|
{
|
||||||
|
NSConnection *root = existingConnection(_receivePort, _receivePort);
|
||||||
|
|
||||||
|
if (root == nil)
|
||||||
|
{
|
||||||
|
root = existingConnection(_receivePort, nil);
|
||||||
|
}
|
||||||
|
[_receivePort setDelegate: root];
|
||||||
|
}
|
||||||
DESTROY(_receivePort);
|
DESTROY(_receivePort);
|
||||||
DESTROY(_sendPort);
|
DESTROY(_sendPort);
|
||||||
|
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
if (_remoteProxies != 0)
|
if (_remoteProxies != 0)
|
||||||
{
|
{
|
||||||
NSFreeMapTable(_remoteProxies);
|
NSFreeMapTable(_remoteProxies);
|
||||||
|
@ -1144,7 +1178,7 @@ static int messages_received_count;
|
||||||
NSFreeMapTable(_localTargets);
|
NSFreeMapTable(_localTargets);
|
||||||
_localTargets = 0;
|
_localTargets = 0;
|
||||||
}
|
}
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
|
|
||||||
DESTROY(_requestQueue);
|
DESTROY(_requestQueue);
|
||||||
if (_replyMap != 0)
|
if (_replyMap != 0)
|
||||||
|
@ -1246,14 +1280,15 @@ static int messages_received_count;
|
||||||
|
|
||||||
void decoder(int argnum, void *datum, const char *type, int flags)
|
void decoder(int argnum, void *datum, const char *type, int flags)
|
||||||
{
|
{
|
||||||
if (type == 0) {
|
if (type == 0)
|
||||||
if (ip) {
|
{
|
||||||
/* this must be here to avoid trashing alloca'ed retframe */
|
if (ip != nil)
|
||||||
[ip dismiss];
|
{
|
||||||
ip = (id)-1;
|
/* this must be here to avoid trashing alloca'ed retframe */
|
||||||
|
ip = (id)-1;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* If we didn't get the reply packet yet, get it now. */
|
/* If we didn't get the reply packet yet, get it now. */
|
||||||
if (!ip)
|
if (!ip)
|
||||||
{
|
{
|
||||||
|
@ -1273,7 +1308,6 @@ static int messages_received_count;
|
||||||
/* Decode the exception object, and raise it. */
|
/* Decode the exception object, and raise it. */
|
||||||
id exc;
|
id exc;
|
||||||
[ip decodeValueOfObjCType: @encode(id) at: &exc];
|
[ip decodeValueOfObjCType: @encode(id) at: &exc];
|
||||||
[ip dismiss];
|
|
||||||
ip = (id)-1;
|
ip = (id)-1;
|
||||||
/* xxx Is there anything else to clean up in
|
/* xxx Is there anything else to clean up in
|
||||||
dissect_method_return()? */
|
dissect_method_return()? */
|
||||||
|
@ -1285,14 +1319,13 @@ static int messages_received_count;
|
||||||
for char*'s. We need to make sure it gets freed eventually
|
for char*'s. We need to make sure it gets freed eventually
|
||||||
so we don't have a memory leak. Request here that it be
|
so we don't have a memory leak. Request here that it be
|
||||||
autorelease'ed. Also autorelease created objects. */
|
autorelease'ed. Also autorelease created objects. */
|
||||||
if (*type == _C_CHARPTR)
|
if ((*type == _C_CHARPTR || *type == _C_PTR) && *(void**)datum != 0)
|
||||||
[NSData dataWithBytesNoCopy: *(void**)datum length: 1];
|
[NSData dataWithBytesNoCopy: *(void**)datum length: 1];
|
||||||
else if (*type == _C_ID)
|
else if (*type == _C_ID)
|
||||||
[*(id*)datum autorelease];
|
AUTORELEASE(*(id*)datum);
|
||||||
}
|
}
|
||||||
|
|
||||||
retframe = mframe_build_return (argframe, type, out_parameters,
|
retframe = mframe_build_return (argframe, type, out_parameters, decoder);
|
||||||
decoder);
|
|
||||||
/* Make sure we processed all arguments, and dismissed the IP.
|
/* Make sure we processed all arguments, and dismissed the IP.
|
||||||
IP is always set to -1 after being dismissed; the only places
|
IP is always set to -1 after being dismissed; the only places
|
||||||
this is done is in this function DECODER(). IP will be nil
|
this is done is in this function DECODER(). IP will be nil
|
||||||
|
@ -1342,7 +1375,7 @@ static int messages_received_count;
|
||||||
NSHashEnumerator enumerator;
|
NSHashEnumerator enumerator;
|
||||||
NSConnection *o;
|
NSConnection *o;
|
||||||
|
|
||||||
[connection_table_gate lock];
|
M_LOCK(connection_table_gate);
|
||||||
enumerator = NSEnumerateHashTable(connection_table);
|
enumerator = NSEnumerateHashTable(connection_table);
|
||||||
while ((o = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
|
while ((o = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
|
||||||
{
|
{
|
||||||
|
@ -1351,7 +1384,7 @@ static int messages_received_count;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[connection_table_gate unlock];
|
M_UNLOCK(connection_table_gate);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -1371,18 +1404,16 @@ static int messages_received_count;
|
||||||
NSMutableArray *components = [msg _components];
|
NSMutableArray *components = [msg _components];
|
||||||
NSPort *rp = [msg receivePort];
|
NSPort *rp = [msg receivePort];
|
||||||
NSPort *sp = [msg sendPort];
|
NSPort *sp = [msg sendPort];
|
||||||
NSConnection *conn = existingConnection(rp, sp);
|
NSConnection *conn;
|
||||||
|
|
||||||
if (debug_connection > 4)
|
if (debug_connection > 4)
|
||||||
{
|
{
|
||||||
NSLog(@"handling packet of type %d (%@)", type, stringFromMsgType(type));
|
NSLog(@"handling packet of type %d (%@)", type, stringFromMsgType(type));
|
||||||
}
|
}
|
||||||
|
conn = [NSConnection connectionWithReceivePort: rp sendPort: sp];
|
||||||
if (conn == nil)
|
if (conn == nil)
|
||||||
{
|
{
|
||||||
if (debug_connection)
|
NSLog(@"received port message for unknown connection - %@", msg);
|
||||||
{
|
|
||||||
NSLog(@"received port message for unknown connection - %@", msg);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ([conn isValid] == NO)
|
else if ([conn isValid] == NO)
|
||||||
|
@ -1435,13 +1466,13 @@ static int messages_received_count;
|
||||||
* If REPLY_DEPTH is non-zero, we may still want to service it now
|
* If REPLY_DEPTH is non-zero, we may still want to service it now
|
||||||
* if independent_queuing is NO.
|
* if independent_queuing is NO.
|
||||||
*/
|
*/
|
||||||
[conn->_queueGate lock];
|
M_LOCK(conn->_queueGate);
|
||||||
if (conn->_requestDepth == 0 || conn->_independentQueueing == NO)
|
if (conn->_requestDepth == 0 || conn->_independentQueueing == NO)
|
||||||
{
|
{
|
||||||
conn->_requestDepth++;
|
conn->_requestDepth++;
|
||||||
[conn->_queueGate unlock];
|
M_UNLOCK(conn->_queueGate);
|
||||||
[conn _service_forwardForProxy: rmc];
|
[conn _service_forwardForProxy: rmc];
|
||||||
[conn->_queueGate lock];
|
M_LOCK(conn->_queueGate);
|
||||||
conn->_requestDepth--;
|
conn->_requestDepth--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1457,12 +1488,12 @@ static int messages_received_count;
|
||||||
rmc = [conn->_requestQueue objectAtIndex: 0];
|
rmc = [conn->_requestQueue objectAtIndex: 0];
|
||||||
RETAIN(rmc);
|
RETAIN(rmc);
|
||||||
[conn->_requestQueue removeObjectAtIndex: 0];
|
[conn->_requestQueue removeObjectAtIndex: 0];
|
||||||
[conn->_queueGate unlock];
|
M_UNLOCK(conn->_queueGate);
|
||||||
[conn _service_forwardForProxy: rmc];
|
[conn _service_forwardForProxy: rmc];
|
||||||
[conn->_queueGate lock];
|
M_LOCK(conn->_queueGate);
|
||||||
RELEASE(rmc);
|
RELEASE(rmc);
|
||||||
}
|
}
|
||||||
[conn->_queueGate unlock];
|
M_UNLOCK(conn->_queueGate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1478,9 +1509,9 @@ static int messages_received_count;
|
||||||
int sequence;
|
int sequence;
|
||||||
|
|
||||||
[rmc decodeValueOfObjCType: @encode(int) at: &sequence];
|
[rmc decodeValueOfObjCType: @encode(int) at: &sequence];
|
||||||
[conn->_queueGate lock];
|
M_LOCK(conn->_queueGate);
|
||||||
NSMapInsert(conn->_replyMap, (void*)sequence, rmc);
|
NSMapInsert(conn->_replyMap, (void*)sequence, rmc);
|
||||||
[conn->_queueGate unlock];
|
M_UNLOCK(conn->_queueGate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1523,7 +1554,6 @@ static int messages_received_count;
|
||||||
"-awake..." methods will get sent before the __builtin_apply! */
|
"-awake..." methods will get sent before the __builtin_apply! */
|
||||||
if (argnum == -1 && datum == 0 && type == 0)
|
if (argnum == -1 && datum == 0 && type == 0)
|
||||||
{
|
{
|
||||||
[aRmc dismiss];
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1532,10 +1562,10 @@ static int messages_received_count;
|
||||||
for char*'s. We need to make sure it gets freed eventually
|
for char*'s. We need to make sure it gets freed eventually
|
||||||
so we don't have a memory leak. Request here that it be
|
so we don't have a memory leak. Request here that it be
|
||||||
autorelease'ed. Also autorelease created objects. */
|
autorelease'ed. Also autorelease created objects. */
|
||||||
if (*type == _C_CHARPTR)
|
if ((*type == _C_CHARPTR || *type == _C_PTR) && *(void**)datum != 0)
|
||||||
[NSData dataWithBytesNoCopy: *(void**)datum length: 1];
|
[NSData dataWithBytesNoCopy: *(void**)datum length: 1];
|
||||||
else if (*type == _C_ID)
|
else if (*type == _C_ID)
|
||||||
[*(id*)datum autorelease];
|
AUTORELEASE(*(id*)datum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder (int argnum, void *datum, const char *type, int flags)
|
void encoder (int argnum, void *datum, const char *type, int flags)
|
||||||
|
@ -1554,18 +1584,18 @@ static int messages_received_count;
|
||||||
}
|
}
|
||||||
switch (*type)
|
switch (*type)
|
||||||
{
|
{
|
||||||
case _C_ID:
|
case _C_ID:
|
||||||
if (flags & _F_BYCOPY)
|
if (flags & _F_BYCOPY)
|
||||||
[op encodeBycopyObject: *(id*)datum];
|
[op encodeBycopyObject: *(id*)datum];
|
||||||
#ifdef _F_BYREF
|
#ifdef _F_BYREF
|
||||||
else if (flags & _F_BYREF)
|
else if (flags & _F_BYREF)
|
||||||
[op encodeByrefObject: *(id*)datum];
|
[op encodeByrefObject: *(id*)datum];
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
[op encodeObject: *(id*)datum];
|
[op encodeObject: *(id*)datum];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
[op encodeValueOfObjCType: type at: datum];
|
[op encodeValueOfObjCType: type at: datum];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,7 +1619,10 @@ static int messages_received_count;
|
||||||
NSLog(@"Handling message from 0x%x", (gsaddr)self);
|
NSLog(@"Handling message from 0x%x", (gsaddr)self);
|
||||||
_reqInCount++; /* Handling an incoming request. */
|
_reqInCount++; /* Handling an incoming request. */
|
||||||
mframe_do_call (forward_type, decoder, encoder);
|
mframe_do_call (forward_type, decoder, encoder);
|
||||||
[self _sendRmc: op type: METHOD_REPLY];
|
if (op != nil)
|
||||||
|
{
|
||||||
|
[self _sendRmc: op type: METHOD_REPLY];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we pass all exceptions back to the requestor. */
|
/* Make sure we pass all exceptions back to the requestor. */
|
||||||
|
@ -1604,7 +1637,7 @@ static int messages_received_count;
|
||||||
{
|
{
|
||||||
op = [self _makeRmc: reply_sequence_number];
|
op = [self _makeRmc: reply_sequence_number];
|
||||||
[op encodeValueOfObjCType: @encode(BOOL)
|
[op encodeValueOfObjCType: @encode(BOOL)
|
||||||
at: &is_exception];
|
at: &is_exception];
|
||||||
[op encodeBycopyObject: localException];
|
[op encodeBycopyObject: localException];
|
||||||
[self _sendRmc: op type: METHOD_REPLY];
|
[self _sendRmc: op type: METHOD_REPLY];
|
||||||
}
|
}
|
||||||
|
@ -1617,9 +1650,10 @@ static int messages_received_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER;
|
NS_ENDHANDLER;
|
||||||
|
if (forward_type != 0)
|
||||||
if (forward_type)
|
{
|
||||||
objc_free (forward_type);
|
NSZoneFree(NSDefaultMallocZone(), forward_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _service_rootObject: (NSPortCoder*)rmc
|
- (void) _service_rootObject: (NSPortCoder*)rmc
|
||||||
|
@ -1633,6 +1667,7 @@ static int messages_received_count;
|
||||||
NSParameterAssert([rmc connection] == self);
|
NSParameterAssert([rmc connection] == self);
|
||||||
|
|
||||||
[rmc decodeValueOfObjCType: @encode(int) at: &sequence];
|
[rmc decodeValueOfObjCType: @encode(int) at: &sequence];
|
||||||
|
op = [self _makeRmc: sequence];
|
||||||
[op encodeObject: rootObject];
|
[op encodeObject: rootObject];
|
||||||
[self _sendRmc: op type: ROOTPROXY_REPLY];
|
[self _sendRmc: op type: ROOTPROXY_REPLY];
|
||||||
}
|
}
|
||||||
|
@ -1690,7 +1725,7 @@ static int messages_received_count;
|
||||||
{
|
{
|
||||||
GSLocalCounter *counter;
|
GSLocalCounter *counter;
|
||||||
|
|
||||||
[global_proxies_gate lock];
|
M_LOCK(global_proxies_gate);
|
||||||
counter = NSMapGet (all_connections_local_targets, (void*)target);
|
counter = NSMapGet (all_connections_local_targets, (void*)target);
|
||||||
if (counter == nil)
|
if (counter == nil)
|
||||||
{
|
{
|
||||||
|
@ -1713,7 +1748,7 @@ static int messages_received_count;
|
||||||
NSLog(@"target (0x%x) moved from cache", target);
|
NSLog(@"target (0x%x) moved from cache", target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[global_proxies_gate unlock];
|
M_UNLOCK(global_proxies_gate);
|
||||||
if (counter == nil)
|
if (counter == nil)
|
||||||
{
|
{
|
||||||
[op encodeObject: @"target not found anywhere"];
|
[op encodeObject: @"target not found anywhere"];
|
||||||
|
@ -1818,23 +1853,23 @@ static int messages_received_count;
|
||||||
NSPortCoder *rmc;
|
NSPortCoder *rmc;
|
||||||
NSDate *timeout_date = nil;
|
NSDate *timeout_date = nil;
|
||||||
|
|
||||||
[_queueGate lock];
|
M_LOCK(_queueGate);
|
||||||
while ((rmc = (NSPortCoder*)NSMapGet(_replyMap, (void*)sn)) == nil)
|
while ((rmc = (NSPortCoder*)NSMapGet(_replyMap, (void*)sn)) == nil)
|
||||||
{
|
{
|
||||||
if (timeout_date == nil)
|
if (timeout_date == nil)
|
||||||
{
|
{
|
||||||
timeout_date = [NSDate dateWithTimeIntervalSinceNow: _replyTimeout];
|
timeout_date = [NSDate dateWithTimeIntervalSinceNow: _replyTimeout];
|
||||||
}
|
}
|
||||||
[_queueGate unlock];
|
M_UNLOCK(_queueGate);
|
||||||
if ([NSRunLoop runOnceBeforeDate: timeout_date
|
if ([NSRunLoop runOnceBeforeDate: timeout_date
|
||||||
forMode: NSConnectionReplyMode] == NO)
|
forMode: NSConnectionReplyMode] == NO)
|
||||||
{
|
{
|
||||||
[NSException raise: NSPortTimeoutException
|
[NSException raise: NSPortTimeoutException
|
||||||
format: @"timed out waiting for reply"];
|
format: @"timed out waiting for reply"];
|
||||||
}
|
}
|
||||||
[_queueGate lock];
|
M_LOCK(_queueGate);
|
||||||
}
|
}
|
||||||
[_queueGate unlock];
|
M_UNLOCK(_queueGate);
|
||||||
return rmc;
|
return rmc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1844,7 +1879,7 @@ static int messages_received_count;
|
||||||
|
|
||||||
NSParameterAssert(_isValid);
|
NSParameterAssert(_isValid);
|
||||||
|
|
||||||
coder = [GSPortCoder portCoderWithReceivePort: [self receivePort]
|
coder = [NSPortCoder portCoderWithReceivePort: [self receivePort]
|
||||||
sendPort: [self sendPort]
|
sendPort: [self sendPort]
|
||||||
components: nil];
|
components: nil];
|
||||||
[coder encodeValueOfObjCType: @encode(int) at: &sequence];
|
[coder encodeValueOfObjCType: @encode(int) at: &sequence];
|
||||||
|
@ -1856,9 +1891,9 @@ static int messages_received_count;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
NSParameterAssert (_isValid);
|
NSParameterAssert (_isValid);
|
||||||
[sequenceNumberGate lock];
|
M_LOCK(sequenceNumberGate);
|
||||||
n = _messageCount++;
|
n = _messageCount++;
|
||||||
[sequenceNumberGate unlock];
|
M_UNLOCK(sequenceNumberGate);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1945,8 +1980,8 @@ static int messages_received_count;
|
||||||
GSLocalCounter *counter;
|
GSLocalCounter *counter;
|
||||||
|
|
||||||
NSParameterAssert (_isValid);
|
NSParameterAssert (_isValid);
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
[global_proxies_gate lock];
|
M_LOCK(global_proxies_gate);
|
||||||
/* xxx Do we need to check to make sure it's not already there? */
|
/* xxx Do we need to check to make sure it's not already there? */
|
||||||
/* This retains object. */
|
/* This retains object. */
|
||||||
NSMapInsert(_localObjects, (void*)object, anObj);
|
NSMapInsert(_localObjects, (void*)object, anObj);
|
||||||
|
@ -1974,8 +2009,8 @@ static int messages_received_count;
|
||||||
NSLog(@"add local object (0x%x) target (0x%x) "
|
NSLog(@"add local object (0x%x) target (0x%x) "
|
||||||
@"to connection (0x%x) (ref %d)",
|
@"to connection (0x%x) (ref %d)",
|
||||||
(gsaddr)object, target, (gsaddr) self, counter->ref);
|
(gsaddr)object, target, (gsaddr) self, counter->ref);
|
||||||
[global_proxies_gate unlock];
|
M_UNLOCK(global_proxies_gate);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDistantObject*) localForObject: (id)object
|
- (NSDistantObject*) localForObject: (id)object
|
||||||
|
@ -1983,9 +2018,9 @@ static int messages_received_count;
|
||||||
NSDistantObject *p;
|
NSDistantObject *p;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
p = NSMapGet (_localObjects, (void*)object);
|
p = NSMapGet (_localObjects, (void*)object);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
NSParameterAssert(!p || [p connectionForProxy] == self);
|
NSParameterAssert(!p || [p connectionForProxy] == self);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -2010,8 +2045,8 @@ static int messages_received_count;
|
||||||
GSLocalCounter *counter;
|
GSLocalCounter *counter;
|
||||||
unsigned val = 0;
|
unsigned val = 0;
|
||||||
|
|
||||||
[global_proxies_gate lock];
|
M_LOCK(global_proxies_gate);
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
|
|
||||||
prox = NSMapGet(_localObjects, (void*)anObj);
|
prox = NSMapGet(_localObjects, (void*)anObj);
|
||||||
target = [prox targetForProxy];
|
target = [prox targetForProxy];
|
||||||
|
@ -2061,8 +2096,8 @@ static int messages_received_count;
|
||||||
@"from connection (0x%x) (ref %d)",
|
@"from connection (0x%x) (ref %d)",
|
||||||
(gsaddr)anObj, target, (gsaddr)self, val);
|
(gsaddr)anObj, target, (gsaddr)self, val);
|
||||||
|
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
[global_proxies_gate unlock];
|
M_UNLOCK(global_proxies_gate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _release_targets: (unsigned*)list count: (unsigned)number
|
- (void) _release_targets: (unsigned*)list count: (unsigned)number
|
||||||
|
@ -2126,7 +2161,6 @@ static int messages_received_count;
|
||||||
[ip decodeValueOfObjCType: @encode(id) at: &result];
|
[ip decodeValueOfObjCType: @encode(id) at: &result];
|
||||||
if (result != nil)
|
if (result != nil)
|
||||||
NSLog(@"failed to retain target - %@", result);
|
NSLog(@"failed to retain target - %@", result);
|
||||||
[ip dismiss];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
|
@ -2141,10 +2175,10 @@ static int messages_received_count;
|
||||||
unsigned target = [aProxy targetForProxy];
|
unsigned target = [aProxy targetForProxy];
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
/* This also releases aProxy */
|
/* This also releases aProxy */
|
||||||
NSMapRemove(_remoteProxies, (void*)target);
|
NSMapRemove(_remoteProxies, (void*)target);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tell the remote application that we have removed our proxy and
|
* Tell the remote application that we have removed our proxy and
|
||||||
|
@ -2158,9 +2192,9 @@ static int messages_received_count;
|
||||||
NSDistantObject *p;
|
NSDistantObject *p;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
p = NSMapGet(_remoteProxies, (void*)target);
|
p = NSMapGet(_remoteProxies, (void*)target);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
NSParameterAssert(!p || [p connectionForProxy] == self);
|
NSParameterAssert(!p || [p connectionForProxy] == self);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -2172,15 +2206,15 @@ static int messages_received_count;
|
||||||
NSParameterAssert (_isValid);
|
NSParameterAssert (_isValid);
|
||||||
NSParameterAssert(aProxy->isa == [NSDistantObject class]);
|
NSParameterAssert(aProxy->isa == [NSDistantObject class]);
|
||||||
NSParameterAssert([aProxy connectionForProxy] == self);
|
NSParameterAssert([aProxy connectionForProxy] == self);
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
if (NSMapGet(_remoteProxies, (void*)target))
|
if (NSMapGet(_remoteProxies, (void*)target))
|
||||||
{
|
{
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
format: @"Trying to add the same proxy twice"];
|
format: @"Trying to add the same proxy twice"];
|
||||||
}
|
}
|
||||||
NSMapInsert(_remoteProxies, (void*)target, aProxy);
|
NSMapInsert(_remoteProxies, (void*)target, aProxy);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) includesProxyForTarget: (unsigned)target
|
- (id) includesProxyForTarget: (unsigned)target
|
||||||
|
@ -2188,9 +2222,9 @@ static int messages_received_count;
|
||||||
NSDistantObject *ret;
|
NSDistantObject *ret;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
ret = NSMapGet (_remoteProxies, (void*)target);
|
ret = NSMapGet (_remoteProxies, (void*)target);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2199,9 +2233,9 @@ static int messages_received_count;
|
||||||
NSDistantObject *ret;
|
NSDistantObject *ret;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
ret = NSMapGet(_localObjects, (void*)anObj);
|
ret = NSMapGet(_localObjects, (void*)anObj);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2210,9 +2244,9 @@ static int messages_received_count;
|
||||||
NSDistantObject *ret;
|
NSDistantObject *ret;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[_proxiesGate lock];
|
M_LOCK(_proxiesGate);
|
||||||
ret = NSMapGet(_localTargets, (void*)target);
|
ret = NSMapGet(_localTargets, (void*)target);
|
||||||
[_proxiesGate unlock];
|
M_UNLOCK(_proxiesGate);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2227,9 +2261,9 @@ static int messages_received_count;
|
||||||
id ret;
|
id ret;
|
||||||
|
|
||||||
/* Don't assert (_isValid); */
|
/* Don't assert (_isValid); */
|
||||||
[global_proxies_gate lock];
|
M_LOCK(global_proxies_gate);
|
||||||
ret = NSMapGet(all_connections_local_targets, (void*)target);
|
ret = NSMapGet(all_connections_local_targets, (void*)target);
|
||||||
[global_proxies_gate unlock];
|
M_UNLOCK(global_proxies_gate);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include <Foundation/NSPort.h>
|
#include <Foundation/NSPort.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
|
||||||
#include <Foundation/DistributedObjects.h>
|
|
||||||
#include <base/fast.x>
|
#include <base/fast.x>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -73,6 +72,8 @@
|
||||||
#include <Foundation/GSPortCoder.h>
|
#include <Foundation/GSPortCoder.h>
|
||||||
#undef _IN_PORT_CODER_M
|
#undef _IN_PORT_CODER_M
|
||||||
|
|
||||||
|
#include <Foundation/DistributedObjects.h>
|
||||||
|
|
||||||
static BOOL debug_port_coder = NO;
|
static BOOL debug_port_coder = NO;
|
||||||
|
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
|
@ -266,7 +267,7 @@ typeCheck(char t1, char t2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@interface GSPortCoder (Private)
|
@interface NSPortCoder (Private)
|
||||||
- (void) _deserializeHeaderAt: (unsigned*)pos
|
- (void) _deserializeHeaderAt: (unsigned*)pos
|
||||||
version: (unsigned*)v
|
version: (unsigned*)v
|
||||||
classes: (unsigned*)c
|
classes: (unsigned*)c
|
||||||
|
@ -282,7 +283,7 @@ typeCheck(char t1, char t2)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation GSPortCoder
|
@implementation NSPortCoder
|
||||||
|
|
||||||
+ (NSPortCoder*) portCoderWithReceivePort: (NSPort*)recv
|
+ (NSPortCoder*) portCoderWithReceivePort: (NSPort*)recv
|
||||||
sendPort: (NSPort*)send
|
sendPort: (NSPort*)send
|
||||||
|
@ -1216,7 +1217,7 @@ typeCheck(char t1, char t2)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = [anObject replacementObjectForPortCoder: self];
|
obj = [anObject replacementObjectForPortCoder: self];
|
||||||
cls = [anObject classForPortCoder];
|
cls = [obj classForPortCoder];
|
||||||
|
|
||||||
(*_xRefImp)(_dst, xRefSel, _GSC_ID, node->value.uint);
|
(*_xRefImp)(_dst, xRefSel, _GSC_ID, node->value.uint);
|
||||||
(*_eValImp)(self, eValSel, @encode(Class), &cls);
|
(*_eValImp)(self, eValSel, @encode(Class), &cls);
|
||||||
|
@ -1294,6 +1295,11 @@ typeCheck(char t1, char t2)
|
||||||
type++;
|
type++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_initialPass == NO)
|
||||||
|
{
|
||||||
|
(*_eTagImp)(_dst, eTagSel, _GSC_ARY_B);
|
||||||
|
}
|
||||||
|
|
||||||
[self encodeArrayOfObjCType: type count: count at: buf];
|
[self encodeArrayOfObjCType: type count: count at: buf];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1668,7 +1674,7 @@ typeCheck(char t1, char t2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation GSPortCoder (Private)
|
@implementation NSPortCoder (Private)
|
||||||
|
|
||||||
- (NSMutableArray*) _components
|
- (NSMutableArray*) _components
|
||||||
{
|
{
|
||||||
|
@ -1752,7 +1758,7 @@ typeCheck(char t1, char t2)
|
||||||
/*
|
/*
|
||||||
* Read header including version and crossref table sizes.
|
* Read header including version and crossref table sizes.
|
||||||
*/
|
*/
|
||||||
_cursor = [[_conn sendPort] reservedSpaceLength];
|
_cursor = 0;
|
||||||
[self _deserializeHeaderAt: &_cursor
|
[self _deserializeHeaderAt: &_cursor
|
||||||
version: &_version
|
version: &_version
|
||||||
classes: &sizeC
|
classes: &sizeC
|
||||||
|
|
|
@ -1521,15 +1521,20 @@ static NSMapTable *tcpPortMap = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) sendBeforeDate: (NSDate*)when
|
- (BOOL) sendBeforeDate: (NSDate*)when
|
||||||
|
msgid: (int)msgId
|
||||||
components: (NSMutableArray*)components
|
components: (NSMutableArray*)components
|
||||||
from: (NSPort*)receivingPort
|
from: (NSPort*)receivingPort
|
||||||
reserved: (unsigned)length
|
reserved: (unsigned)length
|
||||||
msgId: (int)msgId
|
|
||||||
{
|
{
|
||||||
BOOL sent = NO;
|
BOOL sent = NO;
|
||||||
GSTcpHandle *h;
|
GSTcpHandle *h;
|
||||||
unsigned rl = [self reservedSpaceLength];
|
unsigned rl = [self reservedSpaceLength];
|
||||||
|
|
||||||
|
if ([components count] == 0)
|
||||||
|
{
|
||||||
|
NSLog(@"empty components sent");
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* If the reserved length in the first data object is wrong - we have to
|
* If the reserved length in the first data object is wrong - we have to
|
||||||
* fail, unless it's zero, in which case we can insert a data object for
|
* fail, unless it's zero, in which case we can insert a data object for
|
||||||
|
@ -1669,18 +1674,6 @@ static NSMapTable *tcpPortMap = 0;
|
||||||
return sent;
|
return sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) sendBeforeDate: (NSDate*)when
|
|
||||||
components: (NSMutableArray*)components
|
|
||||||
from: (NSPort*)receivingPort
|
|
||||||
reserved: (unsigned)length
|
|
||||||
{
|
|
||||||
return [self sendBeforeDate: (NSDate*)when
|
|
||||||
components: components
|
|
||||||
from: receivingPort
|
|
||||||
reserved: length
|
|
||||||
msgId: GS_CONNECTION_MSG];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSDate*) timedOutEvent: (void*)data
|
- (NSDate*) timedOutEvent: (void*)data
|
||||||
type: (RunLoopEventType)type
|
type: (RunLoopEventType)type
|
||||||
forMode: (NSString*)mode
|
forMode: (NSString*)mode
|
||||||
|
|
|
@ -261,6 +261,11 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
|
||||||
type++;
|
type++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_initialPass == NO)
|
||||||
|
{
|
||||||
|
(*_tagImp)(_dst, tagSel, _GSC_ARY_B);
|
||||||
|
}
|
||||||
|
|
||||||
[self encodeArrayOfObjCType: type count: count at: buf];
|
[self encodeArrayOfObjCType: type count: count at: buf];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -762,7 +767,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = [anObject replacementObjectForArchiver: self];
|
obj = [anObject replacementObjectForArchiver: self];
|
||||||
cls = [anObject classForArchiver];
|
cls = [obj classForArchiver];
|
||||||
|
|
||||||
(*_xRefImp)(_dst, xRefSel, _GSC_ID, node->value.uint);
|
(*_xRefImp)(_dst, xRefSel, _GSC_ID, node->value.uint);
|
||||||
if (_namMap->nodeCount)
|
if (_namMap->nodeCount)
|
||||||
|
|
|
@ -826,15 +826,12 @@ failure:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned len = (length+1)*sizeof(char);
|
unsigned len = (length+1)*sizeof(char);
|
||||||
NSZone *z = [self zone];
|
|
||||||
NSData *d;
|
|
||||||
|
|
||||||
*(char**)data = (char*)NSZoneMalloc(z, len);
|
#if GS_WITH_GC == 0
|
||||||
d = [dataMalloc allocWithZone: z];
|
*(char**)data = (char*)NSZoneMalloc(NSDefaultMallocZone(), len);
|
||||||
d = [d initWithBytesNoCopy: *(void**)data
|
#else
|
||||||
length: len
|
*(char**)data = (char*)NSZoneMalloc(NSAtomicMallocZone(), len);
|
||||||
fromZone: z];
|
#endif
|
||||||
IF_NO_GC(AUTORELEASE(d));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[self deserializeBytes: *(char**)data
|
[self deserializeBytes: *(char**)data
|
||||||
|
@ -896,15 +893,12 @@ failure:
|
||||||
case _C_PTR:
|
case _C_PTR:
|
||||||
{
|
{
|
||||||
unsigned len = objc_sizeof_type(++type);
|
unsigned len = objc_sizeof_type(++type);
|
||||||
NSZone *z = [self zone];
|
|
||||||
NSData *d;
|
|
||||||
|
|
||||||
*(char**)data = (char*)NSZoneMalloc(z, len);
|
#if GS_WITH_GC == 0
|
||||||
d = [dataMalloc allocWithZone: z];
|
*(char**)data = (char*)NSZoneMalloc(NSDefaultMallocZone(), len);
|
||||||
d = [d initWithBytesNoCopy: *(void**)data
|
#else
|
||||||
length: len
|
*(char**)data = (char*)NSZoneMalloc(NSAtomicMallocZone(), len);
|
||||||
fromZone: z];
|
#endif
|
||||||
IF_NO_GC(AUTORELEASE(d));
|
|
||||||
[self deserializeDataAt: *(char**)data
|
[self deserializeDataAt: *(char**)data
|
||||||
ofObjCType: type
|
ofObjCType: type
|
||||||
atCursor: cursor
|
atCursor: cursor
|
||||||
|
@ -1937,14 +1931,10 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSZone *z = [self zone];
|
#if GS_WITH_GC == 0
|
||||||
|
*(char**)data = (char*)NSZoneMalloc(NSDefaultMallocZone(), len+1);
|
||||||
*(char**)data = (char*)NSZoneMalloc(z, len+1);
|
#else
|
||||||
#if !GS_WITH_GC
|
*(char**)data = (char*)NSZoneMalloc(NSAtomicMallocZone(), len+1);
|
||||||
[[[dataMalloc allocWithZone: z]
|
|
||||||
initWithBytesNoCopy: *(void**)data
|
|
||||||
length: len+1
|
|
||||||
fromZone: z] autorelease];
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
getBytes(*(void**)data, bytes, len, length, cursor);
|
getBytes(*(void**)data, bytes, len, length, cursor);
|
||||||
|
@ -2004,14 +1994,11 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
||||||
case _C_PTR:
|
case _C_PTR:
|
||||||
{
|
{
|
||||||
unsigned len = objc_sizeof_type(++type);
|
unsigned len = objc_sizeof_type(++type);
|
||||||
NSZone *z = [self zone];
|
|
||||||
|
|
||||||
*(char**)data = (char*)NSZoneMalloc(z, len);
|
#if GS_WITH_GC == 0
|
||||||
#if !GS_WITH_GC
|
*(char**)data = (char*)NSZoneMalloc(NSDefaultMallocZone(), len);
|
||||||
[[[dataMalloc allocWithZone: z]
|
#else
|
||||||
initWithBytesNoCopy: *(void**)data
|
*(char**)data = (char*)NSZoneMalloc(NSAtomicMallocZone(), len);
|
||||||
length: len
|
|
||||||
fromZone: z] autorelease];
|
|
||||||
#endif
|
#endif
|
||||||
[self deserializeDataAt: *(char**)data
|
[self deserializeDataAt: *(char**)data
|
||||||
ofObjCType: type
|
ofObjCType: type
|
||||||
|
|
|
@ -44,6 +44,7 @@ static Class distantObjectClass = 0;
|
||||||
* allocating the memory for a new instance unless absolutely necessary.
|
* allocating the memory for a new instance unless absolutely necessary.
|
||||||
*/
|
*/
|
||||||
@interface GSDistantObjectPlaceHolder
|
@interface GSDistantObjectPlaceHolder
|
||||||
|
+ (id) initWithCoder: (NSCoder*)aCoder;
|
||||||
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
|
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
|
||||||
+ (id) initWithTarget: (unsigned)target connection: (NSConnection*)aConnection;
|
+ (id) initWithTarget: (unsigned)target connection: (NSConnection*)aConnection;
|
||||||
+ (void) autorelease;
|
+ (void) autorelease;
|
||||||
|
@ -74,6 +75,15 @@ static Class distantObjectClass = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id) initWithCoder: (NSCoder*)aCoder
|
||||||
|
{
|
||||||
|
NSDistantObject *proxy;
|
||||||
|
|
||||||
|
proxy = (NSDistantObject*)NSAllocateObject(distantObjectClass,
|
||||||
|
0, NSDefaultMallocZone());
|
||||||
|
return [proxy initWithCoder: aCoder];
|
||||||
|
}
|
||||||
|
|
||||||
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection
|
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection
|
||||||
{
|
{
|
||||||
NSDistantObject *proxy;
|
NSDistantObject *proxy;
|
||||||
|
@ -182,10 +192,14 @@ enum
|
||||||
gsu8 proxy_tag;
|
gsu8 proxy_tag;
|
||||||
NSConnection *encoder_connection;
|
NSConnection *encoder_connection;
|
||||||
|
|
||||||
if ([aRmc class] != [PortEncoder class])
|
/*
|
||||||
[NSException raise: NSGenericException
|
if ([aRmc isKindOfClass: [NSPortCoder class]] == NO)
|
||||||
format: @"NSDistantObject objects only "
|
{
|
||||||
@"encode with PortEncoder class"];
|
[NSException raise: NSGenericException
|
||||||
|
format: @"NSDistantObject objects only "
|
||||||
|
@"encode with NSPortCoder class"];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
encoder_connection = [(NSPortCoder*)aRmc connection];
|
encoder_connection = [(NSPortCoder*)aRmc connection];
|
||||||
NSAssert(encoder_connection, NSInternalInconsistencyException);
|
NSAssert(encoder_connection, NSInternalInconsistencyException);
|
||||||
|
@ -299,13 +313,15 @@ enum
|
||||||
unsigned target;
|
unsigned target;
|
||||||
id decoder_connection;
|
id decoder_connection;
|
||||||
|
|
||||||
if ([aCoder class] != [PortDecoder class])
|
/*
|
||||||
|
if ([aCoder isKindOfClass: [NSPortCoder class]] == NO)
|
||||||
{
|
{
|
||||||
[self release];
|
[self release];
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
format: @"NSDistantObject objects only decode with "
|
format: @"NSDistantObject objects only decode with "
|
||||||
@"PortDecoder class"];
|
@"NSPortCoder class"];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
decoder_connection = [(NSPortCoder*)aCoder connection];
|
decoder_connection = [(NSPortCoder*)aCoder connection];
|
||||||
NSAssert(decoder_connection, NSInternalInconsistencyException);
|
NSAssert(decoder_connection, NSInternalInconsistencyException);
|
||||||
|
@ -734,7 +750,7 @@ static inline BOOL class_is_kind_of (Class self, Class aClassObject)
|
||||||
return [self class];
|
return [self class];
|
||||||
}
|
}
|
||||||
|
|
||||||
- replacementObjectForPortCoder: (NSPortCoder*)aRmc;
|
- (id) replacementObjectForPortCoder: (NSPortCoder*)aRmc;
|
||||||
{
|
{
|
||||||
if ([aRmc isBycopy])
|
if ([aRmc isBycopy])
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -440,6 +440,7 @@
|
||||||
|
|
||||||
[aCoder decodeValueOfObjCType: @encode(char*) at: &types];
|
[aCoder decodeValueOfObjCType: @encode(char*) at: &types];
|
||||||
newSig = [NSMethodSignature signatureWithObjCTypes: types];
|
newSig = [NSMethodSignature signatureWithObjCTypes: types];
|
||||||
|
NSZoneFree(NSDefaultMallocZone(), (void*)types);
|
||||||
self = [self initWithMethodSignature: newSig];
|
self = [self initWithMethodSignature: newSig];
|
||||||
|
|
||||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_target];
|
[aCoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||||
|
|
|
@ -31,11 +31,28 @@
|
||||||
#include <Foundation/NSRunLoop.h>
|
#include <Foundation/NSRunLoop.h>
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
|
|
||||||
|
@class GSTcpPort;
|
||||||
|
|
||||||
@implementation NSPort
|
@implementation NSPort
|
||||||
|
|
||||||
|
Class _concreteClass;
|
||||||
|
|
||||||
|
+ (id) allocWithZone: (NSZone*)aZone
|
||||||
|
{
|
||||||
|
return [super allocWithZone: aZone];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
if (self == [NSPort class])
|
||||||
|
{
|
||||||
|
_concreteClass = [GSTcpPort class];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSPort*) port
|
+ (NSPort*) port
|
||||||
{
|
{
|
||||||
return AUTORELEASE([self new]);
|
return AUTORELEASE([_concreteClass new]);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSPort*) portWithMachPort: (int)machPort
|
+ (NSPort*) portWithMachPort: (int)machPort
|
||||||
|
@ -159,6 +176,19 @@
|
||||||
components: (NSMutableArray*)components
|
components: (NSMutableArray*)components
|
||||||
from: (NSPort*)receivingPort
|
from: (NSPort*)receivingPort
|
||||||
reserved: (unsigned) length
|
reserved: (unsigned) length
|
||||||
|
{
|
||||||
|
return [self sendBeforeDate: when
|
||||||
|
msgid: 0
|
||||||
|
components: components
|
||||||
|
from: receivingPort
|
||||||
|
reserved: length];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) sendBeforeDate: (NSDate*)when
|
||||||
|
msgid: (int)msgid
|
||||||
|
components: (NSMutableArray*)components
|
||||||
|
from: (NSPort*)receivingPort
|
||||||
|
reserved: (unsigned)length
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return YES;
|
return YES;
|
||||||
|
|
|
@ -518,6 +518,7 @@ typedef enum {
|
||||||
launchCmd = [NSString stringWithCString:
|
launchCmd = [NSString stringWithCString:
|
||||||
make_gdomap_cmd(GNUSTEP_INSTALL_PREFIX)];
|
make_gdomap_cmd(GNUSTEP_INSTALL_PREFIX)];
|
||||||
portClass = [TcpOutPort class];
|
portClass = [TcpOutPort class];
|
||||||
|
// portClass = [GSTcpPort class];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,9 @@
|
||||||
#include <Foundation/NSDate.h>
|
#include <Foundation/NSDate.h>
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <base/BinaryCStream.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
@class TcpInPort;
|
|
||||||
@class PortDecoder;
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -43,9 +40,7 @@ int main (int argc, char *argv[])
|
||||||
GSDebugAllocationActive(YES);
|
GSDebugAllocationActive(YES);
|
||||||
[NSConnection setDebug: 10];
|
[NSConnection setDebug: 10];
|
||||||
[NSDistantObject setDebug: 10];
|
[NSDistantObject setDebug: 10];
|
||||||
[TcpInPort setDebug: 10];
|
[NSPort setDebug: 10];
|
||||||
|
|
||||||
[BinaryCStream setDebugging:YES];
|
|
||||||
|
|
||||||
#if NeXT_runtime
|
#if NeXT_runtime
|
||||||
[NSDistantObject setProtocolForProxies:@protocol(AllProxies)];
|
[NSDistantObject setProtocolForProxies:@protocol(AllProxies)];
|
||||||
|
@ -54,29 +49,25 @@ printf("oneway %d\n", _F_ONEWAY);
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
p = [NSConnection rootProxyAtName: [NSString stringWithCString: argv[2]]
|
p = [NSConnection rootProxyForConnectionWithRegisteredName: [NSString stringWithCString: argv[2]]
|
||||||
onHost: [NSString stringWithCString:argv[1]]];
|
host: [NSString stringWithCString:argv[1]]];
|
||||||
else
|
else
|
||||||
p = [NSConnection rootProxyAtName:@"test2server"
|
p = [NSConnection rootProxyForConnectionWithRegisteredName:@"test2server"
|
||||||
onHost:[NSString stringWithCString:argv[1]]];
|
host:[NSString stringWithCString:argv[1]]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p = [NSConnection rootProxyAtName:@"test2server"
|
p = [NSConnection rootProxyForConnectionWithRegisteredName:@"test2server"
|
||||||
onHost:nil];
|
host:nil];
|
||||||
c = [p connectionForProxy];
|
c = [p connectionForProxy];
|
||||||
[c setRequestTimeout:180.0];
|
[c setRequestTimeout:180.0];
|
||||||
[c setReplyTimeout:180.0];
|
[c setReplyTimeout:180.0];
|
||||||
localObj = [[NSObject alloc] init];
|
localObj = [[NSObject alloc] init];
|
||||||
[p outputStats:localObj];
|
[p outputStats:localObj];
|
||||||
fprintf(stderr, "XXXXXXXXXXXXXXXXA %d\n", GSDebugAllocationCount([PortDecoder class]));
|
|
||||||
[p getLong:&i];
|
[p getLong:&i];
|
||||||
fprintf(stderr,"XXXXXXXXXXXXXXXXB %d\n", GSDebugAllocationCount([PortDecoder class]));
|
|
||||||
[p getLong:&i];
|
[p getLong:&i];
|
||||||
[p outputStats:localObj];
|
[p outputStats:localObj];
|
||||||
fprintf(stderr,"XXXXXXXXXXXXXXXXC %d\n", GSDebugAllocationCount([PortDecoder class]));
|
|
||||||
type = [c typeForSelector:sel_get_any_uid("name")
|
type = [c typeForSelector:sel_get_any_uid("name")
|
||||||
remoteTarget:[p targetForProxy]];
|
remoteTarget:[p targetForProxy]];
|
||||||
printf("XXXXXXXXXXXXXXXXD %d\n", GSDebugAllocationCount([PortDecoder class]));
|
|
||||||
printf(">>type = %s\n", type);
|
printf(">>type = %s\n", type);
|
||||||
printf(">>list proxy's hash is 0x%x\n",
|
printf(">>list proxy's hash is 0x%x\n",
|
||||||
(unsigned)[p hash]);
|
(unsigned)[p hash]);
|
||||||
|
|
|
@ -251,12 +251,15 @@ int main(int argc, char *argv[])
|
||||||
#if NeXT_runtime
|
#if NeXT_runtime
|
||||||
[NSDistantObject setProtocolForProxies:@protocol(AllProxies)];
|
[NSDistantObject setProtocolForProxies:@protocol(AllProxies)];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
c = [NSConnection defaultConnection];
|
||||||
|
[c setRootObject: l];
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
c = [NSConnection newRegisteringAtName:
|
[c registerName: [NSString stringWithCString: argv[1]]];
|
||||||
[NSString stringWithCString: argv[1]]
|
|
||||||
withRootObject:l];
|
|
||||||
else
|
else
|
||||||
c = [NSConnection newRegisteringAtName:@"test2server" withRootObject:l];
|
[c registerName: @"test2server"];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserver: l
|
addObserver: l
|
||||||
selector: @selector(connectionBecameInvalid:)
|
selector: @selector(connectionBecameInvalid:)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue