mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
request time in milliseconds. shorter intervals. interval variance
This commit is contained in:
@@ -21,7 +21,7 @@ namespace data
|
||||
{
|
||||
RequestedDestination::RequestedDestination (const IdentHash& destination, bool isExploratory, bool direct):
|
||||
m_Destination (destination), m_IsExploratory (isExploratory), m_IsDirect (direct), m_IsActive (true),
|
||||
m_CreationTime (i2p::util::GetSecondsSinceEpoch ()), m_LastRequestTime (0), m_NumAttempts (0)
|
||||
m_CreationTime (i2p::util::GetMillisecondsSinceEpoch ()), m_LastRequestTime (0), m_NumAttempts (0)
|
||||
{
|
||||
if (i2p::context.IsFloodfill ())
|
||||
m_ExcludedPeers.insert (i2p::context.GetIdentHash ()); // exclude self if floodfill
|
||||
@@ -44,7 +44,7 @@ namespace data
|
||||
msg = i2p::CreateRouterInfoDatabaseLookupMsg(m_Destination, i2p::context.GetIdentHash(), 0, m_IsExploratory, &m_ExcludedPeers);
|
||||
if(router)
|
||||
m_ExcludedPeers.insert (router->GetIdentHash ());
|
||||
m_LastRequestTime = i2p::util::GetSecondsSinceEpoch ();
|
||||
m_LastRequestTime = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
m_NumAttempts++;
|
||||
return msg;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace data
|
||||
i2p::context.GetRouterInfo ().GetIdentHash () , 0, false, &m_ExcludedPeers);
|
||||
m_ExcludedPeers.insert (floodfill);
|
||||
m_NumAttempts++;
|
||||
m_LastRequestTime = i2p::util::GetSecondsSinceEpoch ();
|
||||
m_LastRequestTime = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace data
|
||||
|
||||
void NetDbRequests::ManageRequests ()
|
||||
{
|
||||
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
||||
uint64_t ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
for (auto it = m_RequestedDestinations.begin (); it != m_RequestedDestinations.end ();)
|
||||
{
|
||||
auto& dest = it->second;
|
||||
@@ -328,7 +328,8 @@ namespace data
|
||||
|
||||
void NetDbRequests::ScheduleManageRequests ()
|
||||
{
|
||||
m_ManageRequestsTimer.expires_from_now (boost::posix_time::seconds(MANAGE_REQUESTS_INTERVAL));
|
||||
m_ManageRequestsTimer.expires_from_now (boost::posix_time::milliseconds(MANAGE_REQUESTS_INTERVAL +
|
||||
m_Rng () % MANAGE_REQUESTS_INTERVAL_VARIANCE));
|
||||
m_ManageRequestsTimer.async_wait (std::bind (&NetDbRequests::HandleManageRequestsTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user