diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2020-11-24 12:24:18 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2021-03-01 12:57:01 +0100 |
commit | 1f75a653dd3b24ba2e4383bf951a6e5a3d5ccbcf (patch) | |
tree | 3970bfe5c18eda448846f3769930c34757d193fb | |
parent | 25605895afe84b1765dd9da9240af22f99489df7 (diff) |
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.
-rw-r--r-- | src/net.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index f90131f1c9..a0072800e2 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1020,6 +1020,8 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) { LogPrintf("Warning: Unknown socket family\n"); } + const CAddress addr_bind = GetBindAddress(hSocket); + NetPermissionFlags permissionFlags = NetPermissionFlags::PF_NONE; hListenSocket.AddSocketPermissionFlags(permissionFlags); AddWhitelistPermissionFlags(permissionFlags, addr); @@ -1085,7 +1087,6 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) { NodeId id = GetNewNodeId(); uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize(); - CAddress addr_bind = GetBindAddress(hSocket); ServiceFlags nodeServices = nLocalServices; if (NetPermissions::HasFlag(permissionFlags, PF_BLOOMFILTER)) { |