TunnelPool: don't enforce ECIES for tunnel selection for now, causes seg fault.

This commit is contained in:
dr|z3d 2021-09-05 03:12:01 +00:00
parent feed4c8d4b
commit 2caffa56e8

View file

@ -453,7 +453,7 @@ namespace tunnel
(inbound && i2p::transport::transports.GetNumPeers () > 25)) (inbound && i2p::transport::transports.GetNumPeers () > 25))
{ {
auto r = i2p::transport::transports.GetRandomPeer (); auto r = i2p::transport::transports.GetRandomPeer ();
if (r && r->IsECIES () && !r->GetProfile ()->IsBad () && if (r && r->IsECIES () && !r->GetProfile ()->IsBad () &&
(numHops > 1 || (r->IsV4 () && (!inbound || r->IsReachable ())))) // first inbound must be reachable (numHops > 1 || (r->IsV4 () && (!inbound || r->IsReachable ())))) // first inbound must be reachable
{ {
prevHop = r; prevHop = r;
@ -467,9 +467,9 @@ namespace tunnel
auto hop = nextHop (prevHop, inbound); auto hop = nextHop (prevHop, inbound);
if (!hop && !i) // if no suitable peer found for first hop, try already connected if (!hop && !i) // if no suitable peer found for first hop, try already connected
{ {
LogPrint (eLogInfo, "Tunnels: Can't select first hop for a tunnel. Trying already connected"); LogPrint (eLogInfo, "Tunnels: No suitable peer found for first hop, trying existing connections");
hop = i2p::transport::transports.GetRandomPeer (); hop = i2p::transport::transports.GetRandomPeer ();
if (!hop->IsECIES ()) hop = nullptr; //if (!hop->IsECIES ()) hop = nullptr;
} }
if (!hop) if (!hop)
{ {
@ -514,15 +514,15 @@ namespace tunnel
auto& ident = (*m_ExplicitPeers)[i]; auto& ident = (*m_ExplicitPeers)[i];
auto r = i2p::data::netdb.FindRouter (ident); auto r = i2p::data::netdb.FindRouter (ident);
if (r) if (r)
{ {
if (r->IsECIES ()) if (r->IsECIES ())
path.Add (r); path.Add (r);
else else
{ {
LogPrint (eLogError, "Tunnels: ElGamal router ", ident.ToBase64 (), " is not supported"); LogPrint (eLogError, "Tunnels: ElGamal router ", ident.ToBase64 (), " is not supported");
return false; return false;
} }
} }
else else
{ {
LogPrint (eLogInfo, "Tunnels: Can't find router for ", ident.ToBase64 ()); LogPrint (eLogInfo, "Tunnels: Can't find router for ", ident.ToBase64 ());