mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Fall back on default port number if necessary.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3324 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fce2236920
commit
935d88e101
1 changed files with 43 additions and 2 deletions
|
@ -789,11 +789,51 @@ static NSPortNameServer *defaultServer = nil;
|
|||
hostname = @"localhost";
|
||||
}
|
||||
|
||||
expecting = 1;
|
||||
handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
|
||||
NS_DURING
|
||||
{
|
||||
handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
|
||||
service: serverPort
|
||||
protocol: @"tcp"
|
||||
forModes: modes];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
if ([[localException name] isEqual: NSInvalidArgumentException])
|
||||
{
|
||||
NSLog(@"Exception looking up port for gdomap - %@\n", localException);
|
||||
handle = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
[localException raise];
|
||||
}
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (handle == nil)
|
||||
{
|
||||
NSLog(@"Failed to find gdomap port with name '%@',\nperhaps your "
|
||||
@"/etc/services file is not correctly set up?\n"
|
||||
@"Retrying with default (IANA allocated) port number 538",
|
||||
serverPort);
|
||||
NS_DURING
|
||||
{
|
||||
handle = [NSFileHandle fileHandleAsClientInBackgroundAtAddress: host
|
||||
service: @"538"
|
||||
protocol: @"tcp"
|
||||
forModes: modes];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
if (handle)
|
||||
{
|
||||
[serverPort release];
|
||||
serverPort = @"538";
|
||||
}
|
||||
}
|
||||
|
||||
if (handle == nil)
|
||||
{
|
||||
|
@ -802,6 +842,7 @@ static NSPortNameServer *defaultServer = nil;
|
|||
hostname];
|
||||
}
|
||||
|
||||
expecting = 1;
|
||||
[handle retain];
|
||||
[NSNotificationCenter addObserver: self
|
||||
selector: @selector(_didConnect:)
|
||||
|
|
Loading…
Reference in a new issue