Skip to content

Commit ba8997f

Browse files
committed
net: update GetNetworkName() with all enum Network cases
1 parent 0d22482 commit ba8997f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/netbase.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,20 @@ enum Network ParseNetwork(const std::string& net_in) {
5252
return NET_UNROUTABLE;
5353
}
5454

55-
std::string GetNetworkName(enum Network net) {
56-
switch(net)
57-
{
55+
std::string GetNetworkName(enum Network net)
56+
{
57+
switch (net) {
58+
case NET_UNROUTABLE: return "unroutable";
5859
case NET_IPV4: return "ipv4";
5960
case NET_IPV6: return "ipv6";
6061
case NET_ONION: return "onion";
61-
default: return "";
62-
}
62+
case NET_I2P: return "i2p";
63+
case NET_CJDNS: return "cjdns";
64+
case NET_INTERNAL: return "internal";
65+
case NET_MAX: assert(false);
66+
} // no default case, so the compiler can warn about missing cases
67+
68+
assert(false);
6369
}
6470

6571
bool static LookupIntern(const std::string& name, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup)

0 commit comments

Comments
 (0)