Force use of a socket port name server to look up servers on other hosts.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@38151 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2014-11-02 22:11:55 +00:00
parent 78991ff299
commit c3b1467afe
2 changed files with 22 additions and 10 deletions

View file

@ -1,6 +1,11 @@
2014-11-02 Wolfgang Lux <wolfgang.lux@gmail.com>
* Frameworks/StepTalk/STRemoteConversation.m (connectionDidDie:):
* Frameworks/StepTalk/STRemoteConversation.m (-open): Force use of
a socket port name server to look up servers on other hosts.
2014-11-02 Wolfgang Lux <wolfgang.lux@gmail.com>
* Frameworks/StepTalk/STRemoteConversation.m (-connectionDidDie:):
Fix leak of the proxy and environmentProcess attributes when a
connection died.

View file

@ -6,6 +6,7 @@
#import <Foundation/NSNotification.h>
#import <Foundation/NSConnection.h>
#import <Foundation/NSDistantObject.h>
#import <Foundation/NSPortNameServer.h>
#import "STEnvironment.h"
@ -34,23 +35,29 @@
- (void)open
{
NSString *envProcName;
if(connection)
NSPortNameServer *nameServer;
if (connection)
{
[NSException raise:@"STConversationException"
format:@"Unable to open conversation: already opened."];
return;
}
envProcName = [NSString stringWithFormat:@"STEnvironment:%@",
envProcName = [NSString stringWithFormat:@"STEnvironment:%@",
environmentName];
connection = [NSConnection connectionWithRegisteredName:envProcName
host:hostName];
if ([hostName length] > 0)
nameServer = [NSSocketPortNameServer sharedInstance];
else
nameServer = [NSPortNameServer systemDefaultPortNameServer];
connection = [NSConnection connectionWithRegisteredName:envProcName
host:hostName
usingNameServer:nameServer];
RETAIN(connection);
if(!connection)
if (!connection)
{
[NSException raise:@"STConversationException"
format:@"Connection failed for environment '%@'",
@ -61,11 +68,11 @@
environmentProcess = RETAIN([connection rootProxy]);
proxy = RETAIN([environmentProcess createConversation]);
[proxy setProtocolForProxy:@protocol(STConversation)];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(connectionDidDie:)
name: NSConnectionDidDieNotification
name: NSConnectionDidDieNotification
object: connection];
}
- (void)close