Browse Source

don't publish too fast

pull/1553/merge
orignal 4 years ago
parent
commit
c69c4ae8a0
  1. 16
      libi2pd/NetDb.cpp

16
libi2pd/NetDb.cpp

@ -151,15 +151,23 @@ namespace data
lastDestinationCleanup = ts; lastDestinationCleanup = ts;
} }
if (!m_HiddenMode && i2p::transport::transports.IsOnline () && // publish
((m_PublishReplyToken && ts - lastPublish >= NETDB_PUBLISH_CONFIRMATION_TIMEOUT) || if (!m_HiddenMode && i2p::transport::transports.IsOnline ())
i2p::context.GetLastUpdateTime () > lastPublish || {
ts - lastPublish >= NETDB_PUBLISH_INTERVAL)) // update timestamp and publish bool publish = false;
if (m_PublishReplyToken)
{
if (ts - lastPublish >= NETDB_PUBLISH_CONFIRMATION_TIMEOUT) publish = true;
}
else if (i2p::context.GetLastUpdateTime () > lastPublish ||
ts - lastPublish >= NETDB_PUBLISH_INTERVAL) publish = true;
if (publish) // update timestamp and publish
{ {
i2p::context.UpdateTimestamp (ts); i2p::context.UpdateTimestamp (ts);
Publish (); Publish ();
lastPublish = ts; lastPublish = ts;
} }
}
if (ts - lastExploratory >= 30) // exploratory every 30 seconds if (ts - lastExploratory >= 30) // exploratory every 30 seconds
{ {
auto numRouters = m_RouterInfos.size (); auto numRouters = m_RouterInfos.size ();

Loading…
Cancel
Save