mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
reduce memory usage
This commit is contained in:
parent
57d4ccfdfd
commit
c7edc36106
3 changed files with 10 additions and 12 deletions
10
NetDb.cpp
10
NetDb.cpp
|
@ -356,6 +356,7 @@ namespace data
|
|||
if (!r->IsUnreachable () && (!r->UsesIntroducer () || ts < r->GetTimestamp () + 3600*1000LL)) // 1 hour
|
||||
{
|
||||
r->DeleteBuffer ();
|
||||
r->ClearProperties (); // properties are not used for regular routers
|
||||
m_RouterInfos[r->GetIdentHash ()] = r;
|
||||
if (r->IsFloodfill ())
|
||||
m_Floodfills.push_back (r);
|
||||
|
@ -566,8 +567,13 @@ namespace data
|
|||
decompressor.MessageEnd();
|
||||
uint8_t uncompressed[2048];
|
||||
size_t uncomressedSize = decompressor.MaxRetrievable ();
|
||||
decompressor.Get (uncompressed, uncomressedSize);
|
||||
AddRouterInfo (buf + DATABASE_STORE_KEY_OFFSET, uncompressed, uncomressedSize);
|
||||
if (uncomressedSize <= 2048)
|
||||
{
|
||||
decompressor.Get (uncompressed, uncomressedSize);
|
||||
AddRouterInfo (buf + DATABASE_STORE_KEY_OFFSET, uncompressed, uncomressedSize);
|
||||
}
|
||||
else
|
||||
LogPrint ("Invalid RouterInfo uncomressed length ", (int)uncomressedSize);
|
||||
}
|
||||
catch (CryptoPP::Exception& ex)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue