Skip to content

Commit

Permalink
clear unreachable flag upon succesive connect
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jul 17, 2023
1 parent e7157cf commit c620fc1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
9 changes: 3 additions & 6 deletions libi2pd/NetDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,9 @@ namespace data
if (r)
{
r->SetUnreachable (unreachable);
if (unreachable)
{
auto profile = r->GetProfile ();
if (profile)
profile->Unreachable ();
}
auto profile = r->GetProfile ();
if (profile)
profile->Unreachable (unreachable);
}
}

Expand Down
6 changes: 3 additions & 3 deletions libi2pd/Profiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ namespace data
}
}

void RouterProfile::Unreachable ()
void RouterProfile::Unreachable (bool unreachable)
{
m_LastUnreachableTime = i2p::util::GetSecondsSinceEpoch ();
m_LastUnreachableTime = unreachable ? i2p::util::GetSecondsSinceEpoch () : 0;
UpdateTime ();
}

void RouterProfile::Connected ()
{
m_HasConnected = true;
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Profiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace data
void TunnelBuildResponse (uint8_t ret);
void TunnelNonReplied ();

void Unreachable ();
void Unreachable (bool unreachable);
void Connected ();

boost::posix_time::ptime GetLastUpdateTime () const { return m_LastUpdateTime; };
Expand Down
1 change: 1 addition & 0 deletions libi2pd/Transports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ namespace transport
if (transport == i2p::data::RouterInfo::eNTCP2V4 ||
transport == i2p::data::RouterInfo::eNTCP2V6 || transport == i2p::data::RouterInfo::eNTCP2V6Mesh)
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.router = nullptr; // we don't need RouterInfo after successive connect
Expand Down

0 comments on commit c620fc1

Please sign in to comment.