mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
mark and check unreachable ident hashes
This commit is contained in:
parent
e20acb93cf
commit
cd5bfaabb5
|
@ -458,8 +458,20 @@ namespace transport
|
|||
it->second.sessions.front ()->SendI2NPMessages (msgs);
|
||||
else
|
||||
{
|
||||
if (it->second.delayedMessages.size () < MAX_NUM_DELAYED_MESSAGES)
|
||||
auto sz = it->second.delayedMessages.size ();
|
||||
if (sz < MAX_NUM_DELAYED_MESSAGES)
|
||||
{
|
||||
if (sz > CHECK_PROFILE_NUM_DELAYED_MESSAGES)
|
||||
{
|
||||
auto profile = i2p::data::GetRouterProfile (ident);
|
||||
if (profile && profile->IsUnreachable ())
|
||||
{
|
||||
LogPrint (eLogWarning, "Transports: Peer profile for ", ident.ToBase64 (), "reports unreachable. Dropped");
|
||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||
m_Peers.erase (it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (auto& it1: msgs)
|
||||
it->second.delayedMessages.push_back (it1);
|
||||
}
|
||||
|
@ -775,11 +787,8 @@ namespace transport
|
|||
if (it->second.sessions.empty () && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT)
|
||||
{
|
||||
LogPrint (eLogWarning, "Transports: Session to peer ", it->first.ToBase64 (), " has not been created in ", SESSION_CREATION_TIMEOUT, " seconds");
|
||||
auto profile = i2p::data::GetRouterProfile(it->first);
|
||||
if (profile)
|
||||
{
|
||||
profile->TunnelNonReplied();
|
||||
}
|
||||
auto profile = i2p::data::GetRouterProfile (it->first);
|
||||
if (profile) profile->Unreachable ();
|
||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||
it = m_Peers.erase (it);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ namespace transport
|
|||
const uint64_t SESSION_CREATION_TIMEOUT = 15; // in seconds
|
||||
const int PEER_TEST_INTERVAL = 71; // in minutes
|
||||
const int MAX_NUM_DELAYED_MESSAGES = 150;
|
||||
const int CHECK_PROFILE_NUM_DELAYED_MESSAGES = 15; // check profile after
|
||||
class Transports
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue