From 49fba9c1aa699d3aa47ea4dafe07b47c8d0aac6e Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 30 Sep 2020 19:19:19 +0300 Subject: net: Add CNode::ConnectedThroughNetwork member function --- src/net.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index e702c13db3..a8b13124c3 100644 --- a/src/net.h +++ b/src/net.h @@ -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); -- cgit v1.2.3