File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -1005,8 +1005,6 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
1005
1005
socklen_t len = sizeof (sockaddr);
1006
1006
SOCKET hSocket = accept (hListenSocket.socket , (struct sockaddr *)&sockaddr, &len);
1007
1007
CAddress addr;
1008
- int nInbound = 0 ;
1009
- int nMaxInbound = nMaxConnections - m_max_outbound;
1010
1008
1011
1009
if (hSocket == INVALID_SOCKET) {
1012
1010
const int nErr = WSAGetLastError ();
@@ -1024,6 +1022,18 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
1024
1022
1025
1023
NetPermissionFlags permissionFlags = NetPermissionFlags::PF_NONE;
1026
1024
hListenSocket.AddSocketPermissionFlags (permissionFlags);
1025
+
1026
+ CreateNodeFromAcceptedSocket (hSocket, permissionFlags, addr_bind, addr);
1027
+ }
1028
+
1029
+ void CConnman::CreateNodeFromAcceptedSocket (SOCKET hSocket,
1030
+ NetPermissionFlags permissionFlags,
1031
+ const CAddress& addr_bind,
1032
+ const CAddress& addr)
1033
+ {
1034
+ int nInbound = 0 ;
1035
+ int nMaxInbound = nMaxConnections - m_max_outbound;
1036
+
1027
1037
AddWhitelistPermissionFlags (permissionFlags, addr);
1028
1038
if (NetPermissions::HasFlag (permissionFlags, NetPermissionFlags::PF_ISIMPLICIT)) {
1029
1039
NetPermissions::ClearFlag (permissionFlags, PF_ISIMPLICIT);
Original file line number Diff line number Diff line change @@ -1049,6 +1049,20 @@ class CConnman
1049
1049
void ThreadOpenConnections (std::vector<std::string> connect);
1050
1050
void ThreadMessageHandler ();
1051
1051
void AcceptConnection (const ListenSocket& hListenSocket);
1052
+
1053
+ /* *
1054
+ * Create a `CNode` object from a socket that has just been accepted and add the node to
1055
+ * the `vNodes` member.
1056
+ * @param[in] hSocket Connected socket to communicate with the peer.
1057
+ * @param[in] permissionFlags The peer's permissions.
1058
+ * @param[in] addr_bind The address and port at our side of the connection.
1059
+ * @param[in] addr The address and port at the peer's side of the connection.
1060
+ */
1061
+ void CreateNodeFromAcceptedSocket (SOCKET hSocket,
1062
+ NetPermissionFlags permissionFlags,
1063
+ const CAddress& addr_bind,
1064
+ const CAddress& addr);
1065
+
1052
1066
void DisconnectNodes ();
1053
1067
void NotifyNumConnectionsChanged ();
1054
1068
/* * Return true if the peer is inactive and should be disconnected. */
You can’t perform that action at this time.
0 commit comments