Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Add explanatory comment about default port #1392

Merged
merged 1 commit into from
May 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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