|
|
@ -72,11 +72,15 @@ namespace transport |
|
|
|
uint64_t creationTime, nextRouterInfoUpdateTime; |
|
|
|
uint64_t creationTime, nextRouterInfoUpdateTime; |
|
|
|
std::vector<std::shared_ptr<i2p::I2NPMessage> > delayedMessages; |
|
|
|
std::vector<std::shared_ptr<i2p::I2NPMessage> > delayedMessages; |
|
|
|
std::vector<i2p::data::RouterInfo::SupportedTransports> priority; |
|
|
|
std::vector<i2p::data::RouterInfo::SupportedTransports> priority; |
|
|
|
|
|
|
|
bool isHighBandwidth; |
|
|
|
|
|
|
|
|
|
|
|
Peer (std::shared_ptr<const i2p::data::RouterInfo> r, uint64_t ts): |
|
|
|
Peer (std::shared_ptr<const i2p::data::RouterInfo> r, uint64_t ts): |
|
|
|
numAttempts (0), router (r), creationTime (ts), |
|
|
|
numAttempts (0), router (r), creationTime (ts), |
|
|
|
nextRouterInfoUpdateTime (ts + PEER_ROUTER_INFO_UPDATE_INTERVAL) |
|
|
|
nextRouterInfoUpdateTime (ts + PEER_ROUTER_INFO_UPDATE_INTERVAL), |
|
|
|
|
|
|
|
isHighBandwidth (false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (router) |
|
|
|
|
|
|
|
isHighBandwidth = router->IsHighBandwidth (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Done () |
|
|
|
void Done () |
|
|
@ -84,6 +88,13 @@ namespace transport |
|
|
|
for (auto& it: sessions) |
|
|
|
for (auto& it: sessions) |
|
|
|
it->Done (); |
|
|
|
it->Done (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetRouter (std::shared_ptr<const i2p::data::RouterInfo> r) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
router = r; |
|
|
|
|
|
|
|
if (router) |
|
|
|
|
|
|
|
isHighBandwidth = router->IsHighBandwidth (); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const uint64_t SESSION_CREATION_TIMEOUT = 15; // in seconds
|
|
|
|
const uint64_t SESSION_CREATION_TIMEOUT = 15; // in seconds
|
|
|
@ -131,7 +142,7 @@ namespace transport |
|
|
|
bool IsBandwidthExceeded () const; |
|
|
|
bool IsBandwidthExceeded () const; |
|
|
|
bool IsTransitBandwidthExceeded () const; |
|
|
|
bool IsTransitBandwidthExceeded () const; |
|
|
|
size_t GetNumPeers () const { return m_Peers.size (); }; |
|
|
|
size_t GetNumPeers () const { return m_Peers.size (); }; |
|
|
|
std::shared_ptr<const i2p::data::RouterInfo> GetRandomPeer () const; |
|
|
|
std::shared_ptr<const i2p::data::RouterInfo> GetRandomPeer (bool isHighBandwidth) const; |
|
|
|
|
|
|
|
|
|
|
|
/** get a trusted first hop for restricted routes */ |
|
|
|
/** get a trusted first hop for restricted routes */ |
|
|
|
std::shared_ptr<const i2p::data::RouterInfo> GetRestrictedPeer() const; |
|
|
|
std::shared_ptr<const i2p::data::RouterInfo> GetRestrictedPeer() const; |
|
|
|