mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-24 18:34:20 +00:00
postpone updating router profile after tunnel build. Check profiles only in memory
This commit is contained in:
parent
5e301937f2
commit
57986bd348
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2024, The PurpleI2P Project
|
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
@ -179,9 +179,12 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
uint8_t ret = hop->GetRetCode (msg + 1);
|
uint8_t ret = hop->GetRetCode (msg + 1);
|
||||||
LogPrint (eLogDebug, "Tunnel: Build response ret code=", (int)ret);
|
LogPrint (eLogDebug, "Tunnel: Build response ret code=", (int)ret);
|
||||||
auto profile = i2p::data::netdb.FindRouterProfile (hop->ident->GetIdentHash ());
|
if (hop->ident)
|
||||||
if (profile)
|
i2p::data::UpdateRouterProfile (hop->ident->GetIdentHash (),
|
||||||
profile->TunnelBuildResponse (ret);
|
[ret](std::shared_ptr<i2p::data::RouterProfile> profile)
|
||||||
|
{
|
||||||
|
if (profile) profile->TunnelBuildResponse (ret);
|
||||||
|
});
|
||||||
if (ret)
|
if (ret)
|
||||||
// if any of participants declined the tunnel is not established
|
// if any of participants declined the tunnel is not established
|
||||||
established = false;
|
established = false;
|
||||||
@ -743,11 +746,11 @@ namespace tunnel
|
|||||||
while (hop)
|
while (hop)
|
||||||
{
|
{
|
||||||
if (hop->ident)
|
if (hop->ident)
|
||||||
|
i2p::data::UpdateRouterProfile (hop->ident->GetIdentHash (),
|
||||||
|
[](std::shared_ptr<i2p::data::RouterProfile> profile)
|
||||||
{
|
{
|
||||||
auto profile = i2p::data::netdb.FindRouterProfile (hop->ident->GetIdentHash ());
|
if (profile) profile->TunnelNonReplied ();
|
||||||
if (profile)
|
});
|
||||||
profile->TunnelNonReplied ();
|
|
||||||
}
|
|
||||||
hop = hop->next;
|
hop = hop->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2024, The PurpleI2P Project
|
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
@ -560,7 +560,7 @@ namespace tunnel
|
|||||||
i2p::data::netdb.GetRandomRouter (prevHop, reverse, endpoint, false);
|
i2p::data::netdb.GetRandomRouter (prevHop, reverse, endpoint, false);
|
||||||
if (hop)
|
if (hop)
|
||||||
{
|
{
|
||||||
if (!hop->GetProfile ()->IsBad ())
|
if (!hop->HasProfile () || !hop->GetProfile ()->IsBad ())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (tryClient)
|
else if (tryClient)
|
||||||
@ -588,7 +588,7 @@ namespace tunnel
|
|||||||
(inbound && i2p::transport::transports.GetNumPeers () > 25))
|
(inbound && i2p::transport::transports.GetNumPeers () > 25))
|
||||||
{
|
{
|
||||||
auto r = i2p::transport::transports.GetRandomPeer (m_IsHighBandwidth && !i2p::context.IsLimitedConnectivity ());
|
auto r = i2p::transport::transports.GetRandomPeer (m_IsHighBandwidth && !i2p::context.IsLimitedConnectivity ());
|
||||||
if (r && r->IsECIES () && !r->GetProfile ()->IsBad () &&
|
if (r && r->IsECIES () && (!r->HasProfile () || !r->GetProfile ()->IsBad ()) &&
|
||||||
(numHops > 1 || (r->IsV4 () && (!inbound || r->IsPublished (true))))) // first inbound must be published ipv4
|
(numHops > 1 || (r->IsV4 () && (!inbound || r->IsPublished (true))))) // first inbound must be published ipv4
|
||||||
{
|
{
|
||||||
prevHop = r;
|
prevHop = r;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user