mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
don't try to save RouterInfo if no buffer
This commit is contained in:
parent
d15581d95e
commit
c2faa5c614
2 changed files with 10 additions and 4 deletions
|
@ -279,6 +279,7 @@ namespace data
|
||||||
if (!r->Update (buf, len))
|
if (!r->Update (buf, len))
|
||||||
{
|
{
|
||||||
updated = false;
|
updated = false;
|
||||||
|
m_Requests.RequestComplete (ident, r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if (r->IsUnreachable ())
|
if (r->IsUnreachable ())
|
||||||
|
@ -290,6 +291,7 @@ namespace data
|
||||||
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
||||||
m_Floodfills.remove (r);
|
m_Floodfills.remove (r);
|
||||||
}
|
}
|
||||||
|
m_Requests.RequestComplete (ident, nullptr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -645,10 +647,14 @@ namespace data
|
||||||
std::string ident = it.second->GetIdentHashBase64();
|
std::string ident = it.second->GetIdentHashBase64();
|
||||||
if (it.second->IsUpdated ())
|
if (it.second->IsUpdated ())
|
||||||
{
|
{
|
||||||
it.second->SaveToFile (m_Storage.Path(ident));
|
if (it.second->GetBuffer ())
|
||||||
|
{
|
||||||
|
// we have something to save
|
||||||
|
it.second->SaveToFile (m_Storage.Path(ident));
|
||||||
|
it.second->SetUnreachable (false);
|
||||||
|
it.second->DeleteBuffer ();
|
||||||
|
}
|
||||||
it.second->SetUpdated (false);
|
it.second->SetUpdated (false);
|
||||||
it.second->SetUnreachable (false);
|
|
||||||
it.second->DeleteBuffer ();
|
|
||||||
updatedCount++;
|
updatedCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace data
|
||||||
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
|
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
|
||||||
bool IsUnreachable () const { return m_IsUnreachable; };
|
bool IsUnreachable () const { return m_IsUnreachable; };
|
||||||
|
|
||||||
const uint8_t * GetBuffer () const { return m_Buffer->data (); };
|
const uint8_t * GetBuffer () const { return m_Buffer ? m_Buffer->data () : nullptr; };
|
||||||
const uint8_t * LoadBuffer (const std::string& fullPath); // load if necessary
|
const uint8_t * LoadBuffer (const std::string& fullPath); // load if necessary
|
||||||
size_t GetBufferLen () const { return m_BufferLen; };
|
size_t GetBufferLen () const { return m_BufferLen; };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue