mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-10 01:10:32 +00:00
check crypto type and congestion of connected peer for tunnel
This commit is contained in:
parent
28adb54c0a
commit
32ab95478e
@ -1055,7 +1055,7 @@ namespace transport
|
|||||||
[isHighBandwidth](std::shared_ptr<const Peer> peer)->bool
|
[isHighBandwidth](std::shared_ptr<const Peer> peer)->bool
|
||||||
{
|
{
|
||||||
// connected, not overloaded and not slow
|
// connected, not overloaded and not slow
|
||||||
return !peer->router && peer->IsConnected () && peer->isReachable &&
|
return !peer->router && peer->IsConnected () && peer->isEligible &&
|
||||||
peer->sessions.front ()->GetSendQueueSize () <= PEER_ROUTER_INFO_OVERLOAD_QUEUE_SIZE &&
|
peer->sessions.front ()->GetSendQueueSize () <= PEER_ROUTER_INFO_OVERLOAD_QUEUE_SIZE &&
|
||||||
!peer->sessions.front ()->IsSlow () && !peer->sessions.front ()->IsBandwidthExceeded (peer->isHighBandwidth) &&
|
!peer->sessions.front ()->IsSlow () && !peer->sessions.front ()->IsBandwidthExceeded (peer->isHighBandwidth) &&
|
||||||
(!isHighBandwidth || peer->isHighBandwidth);
|
(!isHighBandwidth || peer->isHighBandwidth);
|
||||||
|
@ -72,17 +72,18 @@ 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, isReachable;
|
bool isHighBandwidth, isEligible;
|
||||||
|
|
||||||
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), isReachable (false)
|
isHighBandwidth (false), isEligible (false)
|
||||||
{
|
{
|
||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
isHighBandwidth = router->IsHighBandwidth ();
|
isHighBandwidth = router->IsHighBandwidth ();
|
||||||
isReachable = (bool)router->GetCompatibleTransports (true);
|
isEligible = router->IsECIES () && (bool)router->GetCompatibleTransports (true) && // reachable
|
||||||
|
router->GetCongestion () != i2p::data::RouterInfo::eRejectAll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +102,8 @@ namespace transport
|
|||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
isHighBandwidth = router->IsHighBandwidth ();
|
isHighBandwidth = router->IsHighBandwidth ();
|
||||||
isReachable = (bool)router->GetCompatibleTransports (true);
|
isEligible = router->IsECIES () && (bool)router->GetCompatibleTransports (true) && // reachable
|
||||||
|
router->GetCongestion () != i2p::data::RouterInfo::eRejectAll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user