Browse Source

don't publish too fast

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

22
libi2pd/NetDb.cpp

@ -151,14 +151,22 @@ 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
{ {
i2p::context.UpdateTimestamp (ts); bool publish = false;
Publish (); if (m_PublishReplyToken)
lastPublish = ts; {
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);
Publish ();
lastPublish = ts;
}
} }
if (ts - lastExploratory >= 30) // exploratory every 30 seconds if (ts - lastExploratory >= 30) // exploratory every 30 seconds
{ {

Loading…
Cancel
Save