mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
([Connection +newForInPort:outPort:ancestorConnection:]): Add the in
port to the RunLoop in new RunLoop style. ([Connection -addToRunLoop:forMode:]): Method removed. ([Connection -removeFromRunLoop:forMode:]): Method removed. ([Connection -_getReceivedReplyRmcWithSequenceNumber:]): Use new class method for RunLoop. ([Connection -invalidate]): Remove comment about removing from RunLoop. RunLoop's now automatically remove invalid ports. (RunLoopConnectionReplyMode): New run loop mode string. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1192 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0309cdbdea
commit
83525eb693
1 changed files with 11 additions and 34 deletions
|
@ -413,7 +413,10 @@ static int messages_received_count;
|
||||||
if (!(ancestor = NSMapGet (in_port_2_ancestor, ip)))
|
if (!(ancestor = NSMapGet (in_port_2_ancestor, ip)))
|
||||||
{
|
{
|
||||||
NSMapInsert (in_port_2_ancestor, ip, newConn);
|
NSMapInsert (in_port_2_ancestor, ip, newConn);
|
||||||
[ip addToRunLoop: [RunLoop currentInstance] forMode: nil];
|
[[RunLoop currentInstance] addPort: ip
|
||||||
|
forMode: RunLoopDefaultMode];
|
||||||
|
[[RunLoop currentInstance] addPort: ip
|
||||||
|
forMode: RunLoopConnectionReplyMode];
|
||||||
/* This will cause the connection with the registered name
|
/* This will cause the connection with the registered name
|
||||||
to receive the -invokeWithObject: from the IN_PORT.
|
to receive the -invokeWithObject: from the IN_PORT.
|
||||||
This ends up being the ancestor of future new Connections
|
This ends up being the ancestor of future new Connections
|
||||||
|
@ -469,9 +472,6 @@ static int messages_received_count;
|
||||||
|
|
||||||
[connection_array_gate unlock];
|
[connection_array_gate unlock];
|
||||||
|
|
||||||
/* [newConn addToRunLoop: [RunLoop currentInstance] forMode: nil];
|
|
||||||
This already done above. */
|
|
||||||
|
|
||||||
[NotificationDispatcher
|
[NotificationDispatcher
|
||||||
postNotificationName: ConnectionWasCreatedNotification
|
postNotificationName: ConnectionWasCreatedNotification
|
||||||
object: newConn];
|
object: newConn];
|
||||||
|
@ -790,26 +790,6 @@ static int messages_received_count;
|
||||||
|
|
||||||
/* Running the connection, getting/sending requests/replies. */
|
/* Running the connection, getting/sending requests/replies. */
|
||||||
|
|
||||||
- (void) addToRunLoop: run_loop forMode: (id <String>)mode
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
[in_port addToRunLoop: run_loop forMode: mode];
|
|
||||||
if (out_port == nil)
|
|
||||||
/* This will cause the connection with the registered name
|
|
||||||
to receive the -invokeWithObject: from the IN_PORT.
|
|
||||||
This ends up being the `ancestorConnection:' argument in
|
|
||||||
[ConnectedDecoder newDecodingWithPacket:connection:]. */
|
|
||||||
/* xxx Could it happen that this connection was invalidated, but
|
|
||||||
the others would still be OK? That would cause problems.
|
|
||||||
No. I don't think that can happen. */
|
|
||||||
[in_port setReceivedPacketInvocation: (id)[self class]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) removeFromRunLoop: run_loop forMode: (id <String>)mode
|
|
||||||
{
|
|
||||||
[in_port removeFromRunLoop: run_loop forMode: mode];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) runConnectionUntilDate: date
|
- (void) runConnectionUntilDate: date
|
||||||
{
|
{
|
||||||
[RunLoop runUntilDate: date];
|
[RunLoop runUntilDate: date];
|
||||||
|
@ -935,8 +915,8 @@ static int messages_received_count;
|
||||||
if (!timeout_date)
|
if (!timeout_date)
|
||||||
timeout_date = [[NSDate alloc]
|
timeout_date = [[NSDate alloc]
|
||||||
initWithTimeIntervalSinceNow: in_timeout];
|
initWithTimeIntervalSinceNow: in_timeout];
|
||||||
[[RunLoop currentInstance] runOnceBeforeDate: timeout_date
|
[RunLoop runOnceBeforeDate: timeout_date
|
||||||
forMode: nil];
|
forMode: nil];
|
||||||
}
|
}
|
||||||
reply_depth--;
|
reply_depth--;
|
||||||
return rmc;
|
return rmc;
|
||||||
|
@ -1336,14 +1316,6 @@ static int messages_received_count;
|
||||||
[[in_port description] cStringNoCopy],
|
[[in_port description] cStringNoCopy],
|
||||||
[[out_port description] cStringNoCopy]);
|
[[out_port description] cStringNoCopy]);
|
||||||
|
|
||||||
/* We actually need to know *which* RunLoops to remove
|
|
||||||
outselves from. */
|
|
||||||
/* xxx No. We aren't the only Connection listening to this in
|
|
||||||
port. This would be correct if we properly counted that adds
|
|
||||||
and removes.
|
|
||||||
[self removeFromRunLoop: [RunLoop currentInstance]
|
|
||||||
forMode: nil]; */
|
|
||||||
|
|
||||||
[NotificationDispatcher
|
[NotificationDispatcher
|
||||||
postNotificationName: ConnectionBecameInvalidNotification
|
postNotificationName: ConnectionBecameInvalidNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
@ -1393,3 +1365,8 @@ NSString *ConnectionBecameInvalidNotification
|
||||||
|
|
||||||
NSString *ConnectionWasCreatedNotification
|
NSString *ConnectionWasCreatedNotification
|
||||||
= @"ConnectionWasCreatedNotification";
|
= @"ConnectionWasCreatedNotification";
|
||||||
|
|
||||||
|
|
||||||
|
/* RunLoop modes */
|
||||||
|
NSString *RunLoopConnectionReplyMode
|
||||||
|
= @"RunLoopConnectionReplyMode";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue