mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 12:24:19 +00:00
reduce memory usage
This commit is contained in:
parent
57d4ccfdfd
commit
c7edc36106
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)
|
||||
{
|
||||
|
@ -553,14 +553,6 @@ namespace data
|
||||
m_Properties[key] = value;
|
||||
}
|
||||
|
||||
const char * RouterInfo::GetProperty (const char * key) const
|
||||
{
|
||||
auto it = m_Properties.find (key);
|
||||
if (it != m_Properties.end ())
|
||||
return it->second.c_str ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool RouterInfo::IsFloodfill () const
|
||||
{
|
||||
return m_Caps & Caps::eFloodfill;
|
||||
|
@ -105,8 +105,8 @@ namespace data
|
||||
void AddSSUAddress (const char * host, int port, const uint8_t * key, int mtu = 0);
|
||||
bool AddIntroducer (const Address * address, uint32_t tag);
|
||||
bool RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
|
||||
void SetProperty (const char * key, const char * value);
|
||||
const char * GetProperty (const char * key) const;
|
||||
void SetProperty (const char * key, const char * value); // called from RouterContext only
|
||||
void ClearProperties () { m_Properties.clear (); };
|
||||
bool IsFloodfill () const;
|
||||
bool IsNTCP (bool v4only = true) const;
|
||||
bool IsSSU (bool v4only = true) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user