From 0090b1fe341ee8c0778423f1e6b090cd09897109 Mon Sep 17 00:00:00 2001 From: abitmore Date: Thu, 15 Sep 2022 16:19:33 +0000 Subject: [PATCH] Fix a code smell --- libraries/net/node.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index 5ecc9eb374..f1ff9177de 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -2098,9 +2098,10 @@ namespace graphene { namespace net { namespace detail { { // Our best guess for the peer's inbound endpoint now is its remote endpoint, // unless we are behind a reverse proxy, in which case we try to use a public address - if( originating_peer->get_remote_endpoint()->get_address().is_public_address() + auto remote_endpoint = originating_peer->get_remote_endpoint(); // Note: this returns a copy + if( remote_endpoint->get_address().is_public_address() || !originating_peer->get_endpoint_for_connecting()->get_address().is_public_address() ) - originating_peer->remote_inbound_endpoint = originating_peer->get_remote_endpoint(); + originating_peer->remote_inbound_endpoint = remote_endpoint; // else do nothing // We could reinitialize inbound endpoint verification here, but it doesn't seem necessary