aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2020-08-10 18:30:04 -0700
committerAmiti Uttarwar <amiti@uttarwar.org>2020-09-21 19:01:29 -0700
commit49c10a9ca40967d28ae16dfea9cccc6f3a6624a1 (patch)
tree46b2eb17cde91c46c4d17c56ab6251fa46d9744f /src/net.cpp
parent77376034d4abab292be6ade8486bc472c5f75fe3 (diff)
downloadbitcoin-49c10a9ca40967d28ae16dfea9cccc6f3a6624a1.tar.xz
[log] Add connection type to log statement
In addition to adding more specificity to the log statement about the type of connection, this change also consolidates two statements into one. Previously, the second one should have never been hit, since block-relay connections would match the "!IsInboundConn()" condition and return early.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index e7d3a146ff..15675a68ad 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -488,6 +488,26 @@ void CConnman::AddWhitelistPermissionFlags(NetPermissionFlags& flags, const CNet
}
}
+std::string CNode::ConnectionTypeAsString() const
+{
+ switch (m_conn_type) {
+ case ConnectionType::INBOUND:
+ return "inbound";
+ case ConnectionType::MANUAL:
+ return "manual";
+ case ConnectionType::FEELER:
+ return "feeler";
+ case ConnectionType::OUTBOUND_FULL_RELAY:
+ return "outbound-full-relay";
+ case ConnectionType::BLOCK_RELAY:
+ return "block-relay-only";
+ case ConnectionType::ADDR_FETCH:
+ return "addr-fetch";
+ } // no default case, so the compiler can warn about missing cases
+
+ assert(false);
+}
+
std::string CNode::GetAddrName() const {
LOCK(cs_addrName);
return addrName;