diff --git a/src/java/com/threerings/presents/peer/server/PeerManager.java b/src/java/com/threerings/presents/peer/server/PeerManager.java index 5d433b07e..f23899bc5 100644 --- a/src/java/com/threerings/presents/peer/server/PeerManager.java +++ b/src/java/com/threerings/presents/peer/server/PeerManager.java @@ -523,6 +523,20 @@ public abstract class PeerManager 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 * currently connected to this server. diff --git a/src/java/com/threerings/presents/peer/server/PeerNode.java b/src/java/com/threerings/presents/peer/server/PeerNode.java index 8749194ef..5cd57da81 100644 --- a/src/java/com/threerings/presents/peer/server/PeerNode.java +++ b/src/java/com/threerings/presents/peer/server/PeerNode.java @@ -86,21 +86,41 @@ public class PeerNode _client.addClientObserver(this); } + /** + * Returns the {@link Client} instance that manages our connection to this peer. + */ public Client getClient () { return _client; } + /** + * Returns this peer's unique string identifier. + */ public String getNodeName () { return _record.nodeName; } + /** + * Returns the hostname for external clients to use when connecting to this peer. + */ public String getPublicHostName () { 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 () { return _record.port;