Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show All 40 Lines | |||||
// The minimum supported miniUPnPc API version is set to 10. This keeps | // The minimum supported miniUPnPc API version is set to 10. This keeps | ||||
// compatibility with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages. | // compatibility with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages. | ||||
static_assert(MINIUPNPC_API_VERSION >= 10, | static_assert(MINIUPNPC_API_VERSION >= 10, | ||||
"miniUPnPc API version >= 10 assumed"); | "miniUPnPc API version >= 10 assumed"); | ||||
#endif | #endif | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <cmath> | #include <cmath> | ||||
#include <cstdint> | |||||
#include <limits> | #include <limits> | ||||
#include <optional> | #include <optional> | ||||
#include <unordered_map> | #include <unordered_map> | ||||
// How often to dump addresses to peers.dat | // How often to dump addresses to peers.dat | ||||
static constexpr std::chrono::minutes DUMP_PEERS_INTERVAL{15}; | static constexpr std::chrono::minutes DUMP_PEERS_INTERVAL{15}; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost); | std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost); | ||||
static bool vfLimited[NET_MAX] GUARDED_BY(cs_mapLocalHost) = {}; | static bool vfLimited[NET_MAX] GUARDED_BY(cs_mapLocalHost) = {}; | ||||
void CConnman::AddAddrFetch(const std::string &strDest) { | void CConnman::AddAddrFetch(const std::string &strDest) { | ||||
LOCK(m_addr_fetches_mutex); | LOCK(m_addr_fetches_mutex); | ||||
m_addr_fetches.push_back(strDest); | m_addr_fetches.push_back(strDest); | ||||
} | } | ||||
unsigned short GetListenPort() { | uint16_t GetListenPort() { | ||||
return (unsigned short)(gArgs.GetArg("-port", Params().GetDefaultPort())); | return uint16_t(gArgs.GetArg("-port", Params().GetDefaultPort())); | ||||
} | } | ||||
// find 'best' local address for a particular peer | // find 'best' local address for a particular peer | ||||
bool GetLocal(CService &addr, const CNetAddr *paddrPeer) { | bool GetLocal(CService &addr, const CNetAddr *paddrPeer) { | ||||
if (!fListen) { | if (!fListen) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,150 Lines • Show Last 20 Lines |