Skip to content

Commit

Permalink
Add explanatory comment about default port (PegaSysEng#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaxter authored and notlesh committed May 4, 2019
1 parent f9f83c6 commit 7cdb378
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ private Peer createPeer(final PeerInfo peerInfo, final ChannelHandlerContext ctx
final InetSocketAddress remoteAddress = ((InetSocketAddress) ctx.channel().remoteAddress());
int port = peerInfo.getPort();
if (port == 0) {
// Most peers advertise a port of "0", just set a default best guess in this case
// Most peers advertise a port of "0", just set a default best guess in this case.
// We can't simply use the remote address port because peers initiating inbound connections
// are free to choose any port they want for their side of the connection. The remote port
// does not actually correspond to the peer's listening port.
port = EnodeURL.DEFAULT_LISTENING_PORT;
}
return DefaultPeer.fromEnodeURL(
Expand Down

0 comments on commit 7cdb378

Please sign in to comment.