diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2020-11-24 12:40:03 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2021-03-01 12:57:01 +0100 |
commit | 7c224fdac4699a2c4953b33ab423f9cddbf95cf7 (patch) | |
tree | 4902d88f187f5482d04e414ef927cfb6bdc6d4f4 /src/net.h | |
parent | 1f75a653dd3b24ba2e4383bf951a6e5a3d5ccbcf (diff) | |
download | bitcoin-7c224fdac4699a2c4953b33ab423f9cddbf95cf7.tar.xz |
net: isolate the protocol-agnostic part of CConnman::AcceptConnection()
Isolate the second half of `CConnman::AcceptConnection()` into a new
separate method, which could be reused if we accept incoming connections
by other means than `accept()` (first half of
`CConnman::AcceptConnection()`).
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1049,6 +1049,20 @@ private: void ThreadOpenConnections(std::vector<std::string> connect); void ThreadMessageHandler(); void AcceptConnection(const ListenSocket& hListenSocket); + + /** + * Create a `CNode` object from a socket that has just been accepted and add the node to + * the `vNodes` member. + * @param[in] hSocket Connected socket to communicate with the peer. + * @param[in] permissionFlags The peer's permissions. + * @param[in] addr_bind The address and port at our side of the connection. + * @param[in] addr The address and port at the peer's side of the connection. + */ + void CreateNodeFromAcceptedSocket(SOCKET hSocket, + NetPermissionFlags permissionFlags, + const CAddress& addr_bind, + const CAddress& addr); + void DisconnectNodes(); void NotifyNumConnectionsChanged(); /** Return true if the peer is inactive and should be disconnected. */ |