Browse Source

cleanup router's tags

pull/588/head
orignal 8 years ago
parent
commit
1062776762
  1. 8
      NetDb.cpp
  2. 6
      RouterContext.cpp
  3. 1
      RouterContext.h

8
NetDb.cpp

@ -71,7 +71,7 @@ namespace data @@ -71,7 +71,7 @@ namespace data
void NetDb::Run ()
{
uint32_t lastSave = 0, lastPublish = 0, lastExploratory = 0, lastManageRequest = 0;
uint32_t lastSave = 0, lastPublish = 0, lastExploratory = 0, lastManageRequest = 0, lastDestinationCleanup = 0;
while (m_IsRunning)
{
try
@ -121,7 +121,11 @@ namespace data @@ -121,7 +121,11 @@ namespace data
}
lastSave = ts;
}
if (ts - lastDestinationCleanup >= i2p::garlic::INCOMING_TAGS_EXPIRATION_TIMEOUT)
{
i2p::context.CleanupDestination ();
lastDestinationCleanup = ts;
}
// if we're in hidden mode don't publish or explore
// if (m_HiddenMode) continue;

6
RouterContext.cpp

@ -440,6 +440,12 @@ namespace i2p @@ -440,6 +440,12 @@ namespace i2p
i2p::garlic::GarlicDestination::ProcessDeliveryStatusMessage (msg);
}
void RouterContext::CleanupDestination ()
{
std::unique_lock<std::mutex> l(m_GarlicMutex);
i2p::garlic::GarlicDestination::CleanupExpiredTags ();
}
uint32_t RouterContext::GetUptime () const
{
return i2p::util::GetSecondsSinceEpoch () - m_StartupTime;

1
RouterContext.h

@ -72,6 +72,7 @@ namespace i2p @@ -72,6 +72,7 @@ namespace i2p
void UpdateNTCPV6Address (const boost::asio::ip::address& host); // called from NTCP session
void UpdateStats ();
void CleanupDestination (); // garlic destination
// implements LocalDestination
std::shared_ptr<const i2p::data::IdentityEx> GetIdentity () const { return m_Keys.GetPublic (); };

Loading…
Cancel
Save