mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
delete invalid router after update
This commit is contained in:
parent
7bde4de1f5
commit
d15581d95e
3 changed files with 25 additions and 10 deletions
|
@ -276,7 +276,22 @@ namespace data
|
|||
bool wasFloodfill = r->IsFloodfill ();
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
|
||||
r->Update (buf, len);
|
||||
if (!r->Update (buf, len))
|
||||
{
|
||||
updated = false;
|
||||
return r;
|
||||
}
|
||||
if (r->IsUnreachable ())
|
||||
{
|
||||
// delete router as invalid after update
|
||||
m_RouterInfos.erase (ident);
|
||||
if (wasFloodfill)
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
||||
m_Floodfills.remove (r);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
LogPrint (eLogInfo, "NetDb: RouterInfo updated: ", ident.ToBase64());
|
||||
if (wasFloodfill != r->IsFloodfill ()) // if floodfill status updated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue