Added internal hostname reporting, documented other PeerNode methods.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5834 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -523,6 +523,20 @@ public abstract class PeerManager
|
|||||||
return (peer == null) ? null : peer.getPublicHostName();
|
return (peer == null) ? null : peer.getPublicHostName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the internal hostname to use when connecting to the specified peer or null if the
|
||||||
|
* peer is not currently connected to this server. Peers connect to one another via their
|
||||||
|
* internal hostname. Do not publish this data to clients out on the Internets.
|
||||||
|
*/
|
||||||
|
public String getPeerInternalHostName (String nodeName)
|
||||||
|
{
|
||||||
|
if (_nodeName.equals(nodeName)) {
|
||||||
|
return _self.hostName;
|
||||||
|
}
|
||||||
|
PeerNode peer = _peers.get(nodeName);
|
||||||
|
return (peer == null) ? null : peer.getInternalHostName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the port on which to connect to the specified peer or -1 if the peer is not
|
* Returns the port on which to connect to the specified peer or -1 if the peer is not
|
||||||
* currently connected to this server.
|
* currently connected to this server.
|
||||||
|
|||||||
@@ -86,21 +86,41 @@ public class PeerNode
|
|||||||
_client.addClientObserver(this);
|
_client.addClientObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Client} instance that manages our connection to this peer.
|
||||||
|
*/
|
||||||
public Client getClient ()
|
public Client getClient ()
|
||||||
{
|
{
|
||||||
return _client;
|
return _client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this peer's unique string identifier.
|
||||||
|
*/
|
||||||
public String getNodeName ()
|
public String getNodeName ()
|
||||||
{
|
{
|
||||||
return _record.nodeName;
|
return _record.nodeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname for external clients to use when connecting to this peer.
|
||||||
|
*/
|
||||||
public String getPublicHostName ()
|
public String getPublicHostName ()
|
||||||
{
|
{
|
||||||
return _record.publicHostName;
|
return _record.publicHostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname for internal clients to use when connecting to this peer.
|
||||||
|
*/
|
||||||
|
public String getInternalHostName ()
|
||||||
|
{
|
||||||
|
return _record.hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the port on which to connect to this peer.
|
||||||
|
*/
|
||||||
public int getPort ()
|
public int getPort ()
|
||||||
{
|
{
|
||||||
return _record.port;
|
return _record.port;
|
||||||
|
|||||||
Reference in New Issue
Block a user