aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-07-30 15:31:36 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-07-30 15:41:17 +0200
commitc91a9471be7a96311a7e1452a3624aa557bc185d (patch)
treec95261b710c16db57073975196de5cdd33d647be /src/net.cpp
parent60dc8e4208058814494b301c355a5996af9517a9 (diff)
Add IsReachable(net) function
Allows other parts of the program to query for reachable status of a network. Similar to IsLimited(net).
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 62124514c8..27f71e45dc 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -307,12 +307,18 @@ bool IsLocal(const CService& addr)
return mapLocalHost.count(addr) > 0;
}
+/** check whether a given network is one we can probably connect to */
+bool IsReachable(enum Network net)
+{
+ LOCK(cs_mapLocalHost);
+ return vfReachable[net] && !vfLimited[net];
+}
+
/** check whether a given address is in a network we can probably connect to */
bool IsReachable(const CNetAddr& addr)
{
- LOCK(cs_mapLocalHost);
enum Network net = addr.GetNetwork();
- return vfReachable[net] && !vfLimited[net];
+ return IsReachable(net);
}
bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const char* pszKeyword, CNetAddr& ipRet)