Browse Source

clear unreachable flag upon succesive connect

pull/1952/head
orignal 1 year ago
parent
commit
c620fc1232
  1. 9
      libi2pd/NetDb.cpp
  2. 4
      libi2pd/Profiling.cpp
  3. 2
      libi2pd/Profiling.h
  4. 1
      libi2pd/Transports.cpp

9
libi2pd/NetDb.cpp

@ -424,12 +424,9 @@ namespace data
if (r) if (r)
{ {
r->SetUnreachable (unreachable); r->SetUnreachable (unreachable);
if (unreachable) auto profile = r->GetProfile ();
{ if (profile)
auto profile = r->GetProfile (); profile->Unreachable (unreachable);
if (profile)
profile->Unreachable ();
}
} }
} }

4
libi2pd/Profiling.cpp

@ -165,9 +165,9 @@ namespace data
} }
} }
void RouterProfile::Unreachable () void RouterProfile::Unreachable (bool unreachable)
{ {
m_LastUnreachableTime = i2p::util::GetSecondsSinceEpoch (); m_LastUnreachableTime = unreachable ? i2p::util::GetSecondsSinceEpoch () : 0;
UpdateTime (); UpdateTime ();
} }

2
libi2pd/Profiling.h

@ -55,7 +55,7 @@ namespace data
void TunnelBuildResponse (uint8_t ret); void TunnelBuildResponse (uint8_t ret);
void TunnelNonReplied (); void TunnelNonReplied ();
void Unreachable (); void Unreachable (bool unreachable);
void Connected (); void Connected ();
boost::posix_time::ptime GetLastUpdateTime () const { return m_LastUpdateTime; }; boost::posix_time::ptime GetLastUpdateTime () const { return m_LastUpdateTime; };

1
libi2pd/Transports.cpp

@ -716,6 +716,7 @@ namespace transport
if (transport == i2p::data::RouterInfo::eNTCP2V4 || if (transport == i2p::data::RouterInfo::eNTCP2V4 ||
transport == i2p::data::RouterInfo::eNTCP2V6 || transport == i2p::data::RouterInfo::eNTCP2V6Mesh) transport == i2p::data::RouterInfo::eNTCP2V6 || transport == i2p::data::RouterInfo::eNTCP2V6Mesh)
it->second.router->GetProfile ()->Connected (); // outgoing NTCP2 connection if always real it->second.router->GetProfile ()->Connected (); // outgoing NTCP2 connection if always real
i2p::data::netdb.SetUnreachable (ident, false); // clear unreachable
} }
it->second.numAttempts = 0; it->second.numAttempts = 0;
it->second.router = nullptr; // we don't need RouterInfo after successive connect it->second.router = nullptr; // we don't need RouterInfo after successive connect

Loading…
Cancel
Save