mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 16:34:13 +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
|
if (!r->IsUnreachable () && (!r->UsesIntroducer () || ts < r->GetTimestamp () + 3600*1000LL)) // 1 hour
|
||||||
{
|
{
|
||||||
r->DeleteBuffer ();
|
r->DeleteBuffer ();
|
||||||
|
r->ClearProperties (); // properties are not used for regular routers
|
||||||
m_RouterInfos[r->GetIdentHash ()] = r;
|
m_RouterInfos[r->GetIdentHash ()] = r;
|
||||||
if (r->IsFloodfill ())
|
if (r->IsFloodfill ())
|
||||||
m_Floodfills.push_back (r);
|
m_Floodfills.push_back (r);
|
||||||
@ -566,8 +567,13 @@ namespace data
|
|||||||
decompressor.MessageEnd();
|
decompressor.MessageEnd();
|
||||||
uint8_t uncompressed[2048];
|
uint8_t uncompressed[2048];
|
||||||
size_t uncomressedSize = decompressor.MaxRetrievable ();
|
size_t uncomressedSize = decompressor.MaxRetrievable ();
|
||||||
decompressor.Get (uncompressed, uncomressedSize);
|
if (uncomressedSize <= 2048)
|
||||||
AddRouterInfo (buf + DATABASE_STORE_KEY_OFFSET, uncompressed, uncomressedSize);
|
{
|
||||||
|
decompressor.Get (uncompressed, uncomressedSize);
|
||||||
|
AddRouterInfo (buf + DATABASE_STORE_KEY_OFFSET, uncompressed, uncomressedSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LogPrint ("Invalid RouterInfo uncomressed length ", (int)uncomressedSize);
|
||||||
}
|
}
|
||||||
catch (CryptoPP::Exception& ex)
|
catch (CryptoPP::Exception& ex)
|
||||||
{
|
{
|
||||||
|
@ -553,14 +553,6 @@ namespace data
|
|||||||
m_Properties[key] = value;
|
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
|
bool RouterInfo::IsFloodfill () const
|
||||||
{
|
{
|
||||||
return m_Caps & Caps::eFloodfill;
|
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);
|
void AddSSUAddress (const char * host, int port, const uint8_t * key, int mtu = 0);
|
||||||
bool AddIntroducer (const Address * address, uint32_t tag);
|
bool AddIntroducer (const Address * address, uint32_t tag);
|
||||||
bool RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
|
bool RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
|
||||||
void SetProperty (const char * key, const char * value);
|
void SetProperty (const char * key, const char * value); // called from RouterContext only
|
||||||
const char * GetProperty (const char * key) const;
|
void ClearProperties () { m_Properties.clear (); };
|
||||||
bool IsFloodfill () const;
|
bool IsFloodfill () const;
|
||||||
bool IsNTCP (bool v4only = true) const;
|
bool IsNTCP (bool v4only = true) const;
|
||||||
bool IsSSU (bool v4only = true) const;
|
bool IsSSU (bool v4only = true) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user