Skip to content

Commit

Permalink
Use P2P 'from' host when parsing incoming P2P packets, if it is present
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Whitehead <[email protected]>
  • Loading branch information
matthew1001 committed Dec 1, 2023
1 parent 0b28f01 commit 6060030
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,16 @@ protected void handleIncomingPacket(final Endpoint sourceEndpoint, final Packet
.flatMap(Endpoint::getTcpPort)
.orElse(udpPort);

// If the host is present in the P2P packet itself, use that as the endpoint. Otherwise
// take it from the UDP packet source IP.
final String host =
packet
.getPacketData(PingPacketData.class)
.flatMap(PingPacketData::getFrom)
.map(Endpoint::getHost)
.orElse(sourceEndpoint.getHost());

// Notify the peer controller.
final String host = sourceEndpoint.getHost();
final DiscoveryPeer peer =
DiscoveryPeer.fromEnode(
EnodeURLImpl.builder()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=23.10.2-RC1
version=23.10.2-SNAPSHOT

org.gradle.welcome=never
# Set exports/opens flags required by Google Java Format and ErrorProne plugins. (JEP-396)
Expand Down

0 comments on commit 6060030

Please sign in to comment.