mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37: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);
|
it->second.sessions.front ()->SendI2NPMessages (msgs);
|
||||||
else
|
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)
|
for (auto& it1: msgs)
|
||||||
it->second.delayedMessages.push_back (it1);
|
it->second.delayedMessages.push_back (it1);
|
||||||
}
|
}
|
||||||
|
@ -775,11 +787,8 @@ namespace transport
|
||||||
if (it->second.sessions.empty () && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT)
|
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");
|
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);
|
auto profile = i2p::data::GetRouterProfile (it->first);
|
||||||
if (profile)
|
if (profile) profile->Unreachable ();
|
||||||
{
|
|
||||||
profile->TunnelNonReplied();
|
|
||||||
}
|
|
||||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||||
it = m_Peers.erase (it);
|
it = m_Peers.erase (it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ namespace transport
|
||||||
const uint64_t SESSION_CREATION_TIMEOUT = 15; // in seconds
|
const uint64_t SESSION_CREATION_TIMEOUT = 15; // in seconds
|
||||||
const int PEER_TEST_INTERVAL = 71; // in minutes
|
const int PEER_TEST_INTERVAL = 71; // in minutes
|
||||||
const int MAX_NUM_DELAYED_MESSAGES = 150;
|
const int MAX_NUM_DELAYED_MESSAGES = 150;
|
||||||
|
const int CHECK_PROFILE_NUM_DELAYED_MESSAGES = 15; // check profile after
|
||||||
class Transports
|
class Transports
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue