Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Jan 3, 2020
1 parent 858592b commit 57bf61b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/LocalPeerFinder.java
Expand Up @@ -202,6 +202,9 @@ public void run()

}

/**
* Get the local discovery information for this node, if it exists
*/
public LocalPeerDisco getDiscoCache(AddressSpecHash node_id)
{
synchronized(disco_cache)
Expand Down
5 changes: 4 additions & 1 deletion src/PeerLink.java
Expand Up @@ -92,13 +92,16 @@ private ConnectInfo findConnectInfo()
{
NetworkExaminer net_ex = node.getNetworkExaminer();
LocalPeerDisco disco = node.getLocalPeerFinder().getDiscoCache(remote_node_id);

// If we have local discovery information for this node, prefer that over whatever
// is in the PeerInfo.
if (disco != null)
{
logger.fine("Using disco: " + disco);
return ConnectInfo.newBuilder()
.setHost(disco.getIpAddresses(0)) // The local peer finder trims the list to just the one we got this from
.setPort(disco.getPort())
.setProtocol("mcast_disco")
.setProtocol("mcast_disco") // If something reads this proto, something has gone wrong. But setting it just in case.
.build();
}

Expand Down

0 comments on commit 57bf61b

Please sign in to comment.