mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
request newly discovered routers with random intervals after exploratory
This commit is contained in:
parent
0f7db8e418
commit
bb531a878d
2 changed files with 71 additions and 23 deletions
|
@ -28,6 +28,8 @@ namespace data
|
|||
const uint64_t MAX_REQUEST_TIME = MAX_NUM_REQUEST_ATTEMPTS * (MIN_REQUEST_TIME + MANAGE_REQUESTS_INTERVAL);
|
||||
const uint64_t EXPLORATORY_REQUEST_INTERVAL = 55; // in seconds
|
||||
const uint64_t EXPLORATORY_REQUEST_INTERVAL_VARIANCE = 170; // in seconds
|
||||
const uint64_t DISCOVERED_REQUEST_INTERVAL = 360; // in milliseconds
|
||||
const uint64_t DISCOVERED_REQUEST_INTERVAL_VARIANCE = 540; // in milliseconds
|
||||
const uint64_t MAX_EXPLORATORY_REQUEST_TIME = 30; // in seconds
|
||||
const uint64_t REQUEST_CACHE_TIME = MAX_REQUEST_TIME + 40; // in seconds
|
||||
const uint64_t REQUESTED_DESTINATIONS_POOL_CLEANUP_INTERVAL = 191; // in seconds
|
||||
|
@ -96,6 +98,7 @@ namespace data
|
|||
bool SendNextRequest (std::shared_ptr<RequestedDestination> dest);
|
||||
|
||||
void HandleDatabaseSearchReplyMsg (std::shared_ptr<const I2NPMessage> msg);
|
||||
void RequestRouter (const IdentHash& router);
|
||||
void RequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct);
|
||||
void Explore (int numDestinations);
|
||||
void ManageRequests ();
|
||||
|
@ -106,13 +109,17 @@ namespace data
|
|||
void HandleExploratoryTimer (const boost::system::error_code& ecode);
|
||||
void ScheduleCleanup ();
|
||||
void HandleCleanupTimer (const boost::system::error_code& ecode);
|
||||
void ScheduleDiscoveredRoutersRequest ();
|
||||
void HandleDiscoveredRoutersTimer (const boost::system::error_code& ecode);
|
||||
|
||||
private:
|
||||
|
||||
mutable std::mutex m_RequestedDestinationsMutex;
|
||||
std::unordered_map<IdentHash, std::shared_ptr<RequestedDestination> > m_RequestedDestinations;
|
||||
std::list<IdentHash> m_DiscoveredRouterHashes;
|
||||
i2p::util::MemoryPoolMt<RequestedDestination> m_RequestedDestinationsPool;
|
||||
boost::asio::deadline_timer m_ManageRequestsTimer, m_ExploratoryTimer, m_CleanupTimer;
|
||||
boost::asio::deadline_timer m_ManageRequestsTimer, m_ExploratoryTimer,
|
||||
m_CleanupTimer, m_DiscoveredRoutersTimer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue