some cleanup

This commit is contained in:
orignal 2024-03-03 10:28:25 -05:00
parent 20a5e19ea1
commit af0d853ccd

View File

@ -460,9 +460,8 @@ namespace transport
auto it = m_Peers.find (ident); auto it = m_Peers.find (ident);
if (it == m_Peers.end ()) if (it == m_Peers.end ())
{ {
// check if not known as unreachable // check if not banned
auto profile = i2p::data::GetRouterProfile (ident); if (i2p::data::IsRouterBanned (ident)) return; // don't create peer to unreachable router
if (profile && profile->IsUnreachable ()) return; // don't create peer to unreachable router
// try to connect // try to connect
bool connected = false; bool connected = false;
try try
@ -491,7 +490,6 @@ namespace transport
{ {
if (sz < CHECK_PROFILE_NUM_DELAYED_MESSAGES && sz + msgs.size () >= CHECK_PROFILE_NUM_DELAYED_MESSAGES) if (sz < CHECK_PROFILE_NUM_DELAYED_MESSAGES && sz + msgs.size () >= CHECK_PROFILE_NUM_DELAYED_MESSAGES)
{ {
auto profile = i2p::data::GetRouterProfile (ident);
if (i2p::data::IsRouterBanned (ident)) if (i2p::data::IsRouterBanned (ident))
{ {
LogPrint (eLogWarning, "Transports: Router ", ident.ToBase64 (), " is banned. Peer dropped"); LogPrint (eLogWarning, "Transports: Router ", ident.ToBase64 (), " is banned. Peer dropped");