Skip to content

Commit 1f75a65

Browse files
committed
net: get the bind address earlier in CConnman::AcceptConnection()
Call `GetBindAddress()` earlier in `CConnman::AcceptConnection()`. That is specific to the TCP protocol and makes the code below it reusable for other protocols, if the caller provides `addr_bind`, retrieved by other means.
1 parent 2560589 commit 1f75a65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/net.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,8 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
10201020
LogPrintf("Warning: Unknown socket family\n");
10211021
}
10221022

1023+
const CAddress addr_bind = GetBindAddress(hSocket);
1024+
10231025
NetPermissionFlags permissionFlags = NetPermissionFlags::PF_NONE;
10241026
hListenSocket.AddSocketPermissionFlags(permissionFlags);
10251027
AddWhitelistPermissionFlags(permissionFlags, addr);
@@ -1085,7 +1087,6 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
10851087

10861088
NodeId id = GetNewNodeId();
10871089
uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize();
1088-
CAddress addr_bind = GetBindAddress(hSocket);
10891090

10901091
ServiceFlags nodeServices = nLocalServices;
10911092
if (NetPermissions::HasFlag(permissionFlags, PF_BLOOMFILTER)) {

0 commit comments

Comments
 (0)