net: Add CNode::ConnectedThroughNetwork member function

This commit is contained in:
Hennadii Stepanov
2020-09-30 19:19:19 +03:00
parent d4dde24034
commit 49fba9c1aa
4 changed files with 19 additions and 2 deletions

View File

@@ -961,6 +961,18 @@ public:
assert(false);
}
/**
* Get network the peer connected through.
*
* Returns Network::NET_ONION for *inbound* onion connections,
* and CNetAddr::GetNetClass() otherwise. The latter cannot be used directly
* because it doesn't detect the former, and it's not the responsibility of
* the CNetAddr class to know the actual network a peer is connected through.
*
* @return network the peer connected through.
*/
Network ConnectedThroughNetwork() const;
protected:
mapMsgCmdSize mapSendBytesPerMsgCmd;
mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv);