diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2020-11-24 15:36:27 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2021-03-01 12:57:01 +0100 |
commit | f6c267db3be2d7077fd2bdbd34860eba838dea99 (patch) | |
tree | dd2a7126aea151c39442993404002e84a02b75f8 /src/net.cpp | |
parent | 7c224fdac4699a2c4953b33ab423f9cddbf95cf7 (diff) |
net: avoid unnecessary GetBindAddress() call
Our local (bind) address is already saved in `CNode::addrBind` and there
is no need to re-retrieve it again with `GetBindAddress()`.
Also, for I2P connections `CNode::addrBind` would contain our I2P
address, but `GetBindAddress()` would return something like
`127.0.0.1:RANDOM_PORT`.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp index 6109fc4e5a..d03e3cac37 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2606,9 +2606,7 @@ std::vector<CAddress> CConnman::GetAddresses(size_t max_addresses, size_t max_pc std::vector<CAddress> CConnman::GetAddresses(CNode& requestor, size_t max_addresses, size_t max_pct) { - SOCKET socket; - WITH_LOCK(requestor.cs_hSocket, socket = requestor.hSocket); - auto local_socket_bytes = GetBindAddress(socket).GetAddrBytes(); + auto local_socket_bytes = requestor.addrBind.GetAddrBytes(); uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE) .Write(requestor.addr.GetNetwork()) .Write(local_socket_bytes.data(), local_socket_bytes.size()) |