1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 08:14:15 +00:00

request RouterInfo if outdated

This commit is contained in:
orignal 2014-04-05 21:25:54 -04:00
parent 8d3fcff5c5
commit 1862896532
2 changed files with 5 additions and 3 deletions

View File

@ -442,9 +442,11 @@ namespace data
if (dest->IsExploratory ()) if (dest->IsExploratory ())
{ {
if (!FindRouter (router)) // router with ident not found auto r = FindRouter (router);
if (!r || i2p::util::GetMillisecondsSinceEpoch () > r->GetTimestamp () + 3600*1000LL)
{ {
LogPrint ("Found new router. Requesting RouterInfo ..."); // router with ident not found or too old (1 hour)
LogPrint ("Found new/outdated router. Requesting RouterInfo ...");
if (outbound && inbound) if (outbound && inbound)
{ {
RequestedDestination * d1 = CreateRequestedDestination (router, false, false); RequestedDestination * d1 = CreateRequestedDestination (router, false, false);

View File

@ -239,7 +239,7 @@ namespace i2p
// existing session not found. create new // existing session not found. create new
// try NTCP first // try NTCP first
auto address = r->GetNTCPAddress (); auto address = r->GetNTCPAddress ();
if (address && !r->IsUnreachable ()) if (address && !r->UsesIntroducer () && !r->IsUnreachable ())
{ {
auto s = new i2p::ntcp::NTCPClient (m_Service, address->host, address->port, *r); auto s = new i2p::ntcp::NTCPClient (m_Service, address->host, address->port, *r);
AddNTCPSession (s); AddNTCPSession (s);