mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
don't try to save RouterInfo if no buffer
This commit is contained in:
parent
d15581d95e
commit
c2faa5c614
@ -279,6 +279,7 @@ namespace data
|
||||
if (!r->Update (buf, len))
|
||||
{
|
||||
updated = false;
|
||||
m_Requests.RequestComplete (ident, r);
|
||||
return r;
|
||||
}
|
||||
if (r->IsUnreachable ())
|
||||
@ -290,6 +291,7 @@ namespace data
|
||||
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
||||
m_Floodfills.remove (r);
|
||||
}
|
||||
m_Requests.RequestComplete (ident, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -645,10 +647,14 @@ namespace data
|
||||
std::string ident = it.second->GetIdentHashBase64();
|
||||
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->SetUnreachable (false);
|
||||
it.second->DeleteBuffer ();
|
||||
updatedCount++;
|
||||
continue;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ namespace data
|
||||
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
|
||||
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
|
||||
size_t GetBufferLen () const { return m_BufferLen; };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user