mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-29 03:18:28 +00:00
Replace deadline_timer by steady_timer
Prevent deprecation warnings when building.
This commit is contained in:
@@ -405,7 +405,7 @@ namespace client
|
||||
{
|
||||
LogPrint (eLogInfo, "I2PControl: Shutdown requested");
|
||||
InsertParam (results, "Shutdown", "");
|
||||
m_ShutdownTimer.expires_from_now (boost::posix_time::seconds(1)); // 1 second to make sure response has been sent
|
||||
m_ShutdownTimer.expires_after (std::chrono::seconds(1)); // 1 second to make sure response has been sent
|
||||
m_ShutdownTimer.async_wait (
|
||||
[](const boost::system::error_code& ecode)
|
||||
{
|
||||
@@ -419,7 +419,7 @@ namespace client
|
||||
int timeout = i2p::tunnel::tunnels.GetTransitTunnelsExpirationTimeout ();
|
||||
LogPrint (eLogInfo, "I2PControl: Graceful shutdown requested, ", timeout, " seconds remains");
|
||||
InsertParam (results, "ShutdownGraceful", "");
|
||||
m_ShutdownTimer.expires_from_now (boost::posix_time::seconds(timeout + 1)); // + 1 second
|
||||
m_ShutdownTimer.expires_after (std::chrono::seconds(timeout + 1)); // + 1 second
|
||||
m_ShutdownTimer.async_wait (
|
||||
[](const boost::system::error_code& ecode)
|
||||
{
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ namespace client
|
||||
std::unique_ptr<boost::asio::local::stream_protocol::acceptor> m_LocalAcceptor;
|
||||
#endif
|
||||
boost::asio::ssl::context m_SSLContext;
|
||||
boost::asio::deadline_timer m_ShutdownTimer;
|
||||
boost::asio::steady_timer m_ShutdownTimer;
|
||||
std::set<std::string> m_Tokens;
|
||||
|
||||
std::map<std::string, MethodHandler> m_MethodHandlers;
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ namespace transport
|
||||
if (address && !address->host.is_v6 () && address->port)
|
||||
TryPortMapping (address);
|
||||
}
|
||||
m_Timer.expires_from_now (boost::posix_time::minutes(UPNP_PORT_FORWARDING_INTERVAL)); // every 20 minutes
|
||||
m_Timer.expires_after (std::chrono::minutes(UPNP_PORT_FORWARDING_INTERVAL)); // every 20 minutes
|
||||
m_Timer.async_wait ([this](const boost::system::error_code& ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ namespace transport
|
||||
std::condition_variable m_Started;
|
||||
std::mutex m_StartedMutex;
|
||||
boost::asio::io_context m_Service;
|
||||
boost::asio::deadline_timer m_Timer;
|
||||
boost::asio::steady_timer m_Timer;
|
||||
bool m_upnpUrlsInitialized = false;
|
||||
struct UPNPUrls m_upnpUrls;
|
||||
struct IGDdatas m_upnpData;
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace client
|
||||
LoadTags ();
|
||||
m_Pool->SetLocalDestination (shared_from_this ());
|
||||
m_Pool->SetActive (true);
|
||||
m_CleanupTimer.expires_from_now (boost::posix_time::seconds (DESTINATION_CLEANUP_TIMEOUT));
|
||||
m_CleanupTimer.expires_after (std::chrono::seconds (DESTINATION_CLEANUP_TIMEOUT));
|
||||
m_CleanupTimer.async_wait (std::bind (&LeaseSetDestination::HandleCleanupTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -580,7 +580,7 @@ namespace client
|
||||
m_ExcludedFloodfills.clear ();
|
||||
m_PublishReplyToken = 0;
|
||||
// schedule verification
|
||||
m_PublishVerificationTimer.expires_from_now (boost::posix_time::seconds(PUBLISH_VERIFICATION_TIMEOUT +
|
||||
m_PublishVerificationTimer.expires_after (std::chrono::seconds(PUBLISH_VERIFICATION_TIMEOUT +
|
||||
GetRng ()() % PUBLISH_VERIFICATION_TIMEOUT_VARIANCE));
|
||||
m_PublishVerificationTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishVerificationTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
@@ -615,7 +615,7 @@ namespace client
|
||||
{
|
||||
LogPrint (eLogDebug, "Destination: Publishing LeaseSet is too fast. Wait for ", PUBLISH_MIN_INTERVAL, " seconds");
|
||||
m_PublishDelayTimer.cancel ();
|
||||
m_PublishDelayTimer.expires_from_now (boost::posix_time::seconds(PUBLISH_MIN_INTERVAL));
|
||||
m_PublishDelayTimer.expires_after (std::chrono::seconds(PUBLISH_MIN_INTERVAL));
|
||||
m_PublishDelayTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishDelayTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
return;
|
||||
@@ -661,7 +661,7 @@ namespace client
|
||||
m_PublishReplyToken = 1; // dummy non-zero value
|
||||
// try again after a while
|
||||
LogPrint (eLogInfo, "Destination: Can't publish LeasetSet because destination is not ready. Try publishing again after ", PUBLISH_CONFIRMATION_TIMEOUT, " milliseconds");
|
||||
m_PublishConfirmationTimer.expires_from_now (boost::posix_time::milliseconds(PUBLISH_CONFIRMATION_TIMEOUT));
|
||||
m_PublishConfirmationTimer.expires_after (std::chrono::milliseconds(PUBLISH_CONFIRMATION_TIMEOUT));
|
||||
m_PublishConfirmationTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishConfirmationTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
return;
|
||||
@@ -680,7 +680,7 @@ namespace client
|
||||
s->HandlePublishConfirmationTimer (boost::system::error_code());
|
||||
});
|
||||
};
|
||||
m_PublishConfirmationTimer.expires_from_now (boost::posix_time::milliseconds(PUBLISH_CONFIRMATION_TIMEOUT));
|
||||
m_PublishConfirmationTimer.expires_after (std::chrono::milliseconds(PUBLISH_CONFIRMATION_TIMEOUT));
|
||||
m_PublishConfirmationTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishConfirmationTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
outbound->SendTunnelDataMsgTo (floodfill->GetIdentHash (), 0, msg);
|
||||
@@ -720,7 +720,7 @@ namespace client
|
||||
{
|
||||
// we got latest LeasetSet
|
||||
LogPrint (eLogDebug, "Destination: Published LeaseSet verified for ", s->GetIdentHash().ToBase32());
|
||||
s->m_PublishVerificationTimer.expires_from_now (boost::posix_time::seconds(PUBLISH_REGULAR_VERIFICATION_INTERNAL));
|
||||
s->m_PublishVerificationTimer.expires_after (std::chrono::seconds(PUBLISH_REGULAR_VERIFICATION_INTERNAL));
|
||||
s->m_PublishVerificationTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishVerificationTimer, s, std::placeholders::_1));
|
||||
return;
|
||||
}
|
||||
@@ -887,7 +887,7 @@ namespace client
|
||||
nextFloodfill->GetIdentHash (), 0, msg
|
||||
}
|
||||
});
|
||||
request->requestTimeoutTimer.expires_from_now (boost::posix_time::milliseconds(LEASESET_REQUEST_TIMEOUT));
|
||||
request->requestTimeoutTimer.expires_after (std::chrono::milliseconds(LEASESET_REQUEST_TIMEOUT));
|
||||
request->requestTimeoutTimer.async_wait (std::bind (&LeaseSetDestination::HandleRequestTimoutTimer,
|
||||
shared_from_this (), std::placeholders::_1, dest));
|
||||
}
|
||||
@@ -941,7 +941,7 @@ namespace client
|
||||
CleanupExpiredTags ();
|
||||
CleanupRemoteLeaseSets ();
|
||||
CleanupDestination ();
|
||||
m_CleanupTimer.expires_from_now (boost::posix_time::seconds (DESTINATION_CLEANUP_TIMEOUT +
|
||||
m_CleanupTimer.expires_after (std::chrono::seconds (DESTINATION_CLEANUP_TIMEOUT +
|
||||
GetRng ()() % DESTINATION_CLEANUP_TIMEOUT_VARIANCE));
|
||||
m_CleanupTimer.async_wait (std::bind (&LeaseSetDestination::HandleCleanupTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace client
|
||||
LeaseSetRequest (boost::asio::io_context& service): requestTime (0), requestTimeoutTimer (service) {};
|
||||
std::unordered_set<i2p::data::IdentHash> excluded;
|
||||
uint64_t requestTime;
|
||||
boost::asio::deadline_timer requestTimeoutTimer;
|
||||
boost::asio::steady_timer requestTimeoutTimer;
|
||||
std::list<RequestComplete> requestComplete;
|
||||
std::shared_ptr<i2p::tunnel::OutboundTunnel> outboundTunnel;
|
||||
std::shared_ptr<i2p::tunnel::InboundTunnel> replyTunnel;
|
||||
@@ -223,7 +223,7 @@ namespace client
|
||||
uint64_t m_LastSubmissionTime; // in seconds
|
||||
std::unordered_set<i2p::data::IdentHash> m_ExcludedFloodfills; // for publishing
|
||||
|
||||
boost::asio::deadline_timer m_PublishConfirmationTimer, m_PublishVerificationTimer,
|
||||
boost::asio::steady_timer m_PublishConfirmationTimer, m_PublishVerificationTimer,
|
||||
m_PublishDelayTimer, m_CleanupTimer;
|
||||
std::string m_Nickname;
|
||||
int m_LeaseSetType, m_AuthType;
|
||||
@@ -333,7 +333,7 @@ namespace client
|
||||
int m_RefCounter; // how many clients(tunnels) use this destination
|
||||
uint64_t m_LastPublishedTimestamp;
|
||||
|
||||
boost::asio::deadline_timer m_ReadyChecker;
|
||||
boost::asio::steady_timer m_ReadyChecker;
|
||||
|
||||
std::shared_ptr<std::vector<i2p::data::AuthPublicKey> > m_AuthKeys; // we don't need them for I2CP
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace data
|
||||
|
||||
void NetDbRequests::ScheduleCleanup ()
|
||||
{
|
||||
m_CleanupTimer.expires_from_now (boost::posix_time::seconds(REQUESTED_DESTINATIONS_POOL_CLEANUP_INTERVAL));
|
||||
m_CleanupTimer.expires_after (std::chrono::seconds(REQUESTED_DESTINATIONS_POOL_CLEANUP_INTERVAL));
|
||||
m_CleanupTimer.async_wait (std::bind (&NetDbRequests::HandleCleanupTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
@@ -333,7 +333,7 @@ namespace data
|
||||
|
||||
void NetDbRequests::ScheduleManageRequests ()
|
||||
{
|
||||
m_ManageRequestsTimer.expires_from_now (boost::posix_time::milliseconds(MANAGE_REQUESTS_INTERVAL +
|
||||
m_ManageRequestsTimer.expires_after (std::chrono::milliseconds(MANAGE_REQUESTS_INTERVAL +
|
||||
m_Rng () % MANAGE_REQUESTS_INTERVAL_VARIANCE));
|
||||
m_ManageRequestsTimer.async_wait (std::bind (&NetDbRequests::HandleManageRequestsTimer,
|
||||
this, std::placeholders::_1));
|
||||
@@ -508,7 +508,7 @@ namespace data
|
||||
|
||||
void NetDbRequests::ScheduleExploratory (uint64_t interval)
|
||||
{
|
||||
m_ExploratoryTimer.expires_from_now (boost::posix_time::seconds(interval));
|
||||
m_ExploratoryTimer.expires_after (std::chrono::seconds(interval));
|
||||
m_ExploratoryTimer.async_wait (std::bind (&NetDbRequests::HandleExploratoryTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
@@ -539,7 +539,7 @@ namespace data
|
||||
|
||||
void NetDbRequests::ScheduleDiscoveredRoutersRequest ()
|
||||
{
|
||||
m_DiscoveredRoutersTimer.expires_from_now (boost::posix_time::milliseconds(
|
||||
m_DiscoveredRoutersTimer.expires_after (std::chrono::milliseconds(
|
||||
DISCOVERED_REQUEST_INTERVAL + m_Rng () % DISCOVERED_REQUEST_INTERVAL_VARIANCE));
|
||||
m_DiscoveredRoutersTimer.async_wait (std::bind (&NetDbRequests::HandleDiscoveredRoutersTimer,
|
||||
this, std::placeholders::_1));
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace data
|
||||
i2p::util::MemoryPoolMt<RequestedDestination> m_RequestedDestinationsPool;
|
||||
std::unordered_map<IdentHash, std::shared_ptr<RequestedDestination> > m_RequestedDestinations;
|
||||
std::list<IdentHash> m_DiscoveredRouterHashes;
|
||||
boost::asio::deadline_timer m_ManageRequestsTimer, m_ExploratoryTimer,
|
||||
boost::asio::steady_timer m_ManageRequestsTimer, m_ExploratoryTimer,
|
||||
m_CleanupTimer, m_DiscoveredRoutersTimer;
|
||||
std::mt19937 m_Rng;
|
||||
};
|
||||
|
||||
@@ -61,11 +61,11 @@ namespace i2p
|
||||
{
|
||||
m_Service.reset (new RouterService);
|
||||
m_Service->Start ();
|
||||
m_PublishTimer.reset (new boost::asio::deadline_timer (m_Service->GetService ()));
|
||||
m_PublishTimer.reset (new boost::asio::steady_timer (m_Service->GetService ()));
|
||||
ScheduleInitialPublish ();
|
||||
m_CongestionUpdateTimer.reset (new boost::asio::deadline_timer (m_Service->GetService ()));
|
||||
m_CongestionUpdateTimer.reset (new boost::asio::steady_timer (m_Service->GetService ()));
|
||||
ScheduleCongestionUpdate ();
|
||||
m_CleanupTimer.reset (new boost::asio::deadline_timer (m_Service->GetService ()));
|
||||
m_CleanupTimer.reset (new boost::asio::steady_timer (m_Service->GetService ()));
|
||||
ScheduleCleanupTimer ();
|
||||
}
|
||||
}
|
||||
@@ -1426,7 +1426,7 @@ namespace i2p
|
||||
{
|
||||
if (m_PublishTimer)
|
||||
{
|
||||
m_PublishTimer->expires_from_now (boost::posix_time::seconds(ROUTER_INFO_INITIAL_PUBLISH_INTERVAL));
|
||||
m_PublishTimer->expires_after (std::chrono::seconds(ROUTER_INFO_INITIAL_PUBLISH_INTERVAL));
|
||||
m_PublishTimer->async_wait (std::bind (&RouterContext::HandleInitialPublishTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
@@ -1456,7 +1456,7 @@ namespace i2p
|
||||
if (m_PublishTimer)
|
||||
{
|
||||
m_PublishTimer->cancel ();
|
||||
m_PublishTimer->expires_from_now (boost::posix_time::seconds(ROUTER_INFO_PUBLISH_INTERVAL +
|
||||
m_PublishTimer->expires_after (std::chrono::seconds(ROUTER_INFO_PUBLISH_INTERVAL +
|
||||
GetRng ()() % ROUTER_INFO_PUBLISH_INTERVAL_VARIANCE));
|
||||
m_PublishTimer->async_wait (std::bind (&RouterContext::HandlePublishTimer,
|
||||
this, std::placeholders::_1));
|
||||
@@ -1547,7 +1547,7 @@ namespace i2p
|
||||
if (m_PublishTimer)
|
||||
{
|
||||
m_PublishTimer->cancel ();
|
||||
m_PublishTimer->expires_from_now (boost::posix_time::milliseconds(ROUTER_INFO_CONFIRMATION_TIMEOUT));
|
||||
m_PublishTimer->expires_after (std::chrono::milliseconds(ROUTER_INFO_CONFIRMATION_TIMEOUT));
|
||||
m_PublishTimer->async_wait (std::bind (&RouterContext::HandlePublishResendTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
@@ -1570,7 +1570,7 @@ namespace i2p
|
||||
if (m_CongestionUpdateTimer)
|
||||
{
|
||||
m_CongestionUpdateTimer->cancel ();
|
||||
m_CongestionUpdateTimer->expires_from_now (boost::posix_time::seconds(
|
||||
m_CongestionUpdateTimer->expires_after (std::chrono::seconds(
|
||||
ROUTER_INFO_CONGESTION_UPDATE_INTERVAL + GetRng ()() % ROUTER_INFO_CONGESTION_UPDATE_INTERVAL_VARIANCE));
|
||||
m_CongestionUpdateTimer->async_wait (std::bind (&RouterContext::HandleCongestionUpdateTimer,
|
||||
this, std::placeholders::_1));
|
||||
@@ -1610,7 +1610,7 @@ namespace i2p
|
||||
if (m_CleanupTimer)
|
||||
{
|
||||
m_CleanupTimer->cancel ();
|
||||
m_CleanupTimer->expires_from_now (boost::posix_time::seconds(ROUTER_INFO_CLEANUP_INTERVAL));
|
||||
m_CleanupTimer->expires_after (std::chrono::seconds(ROUTER_INFO_CLEANUP_INTERVAL));
|
||||
m_CleanupTimer->async_wait (std::bind (&RouterContext::HandleCleanupTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace garlic
|
||||
i2p::crypto::NoiseSymmetricState m_InitialNoiseState, m_CurrentNoiseState;
|
||||
// publish
|
||||
std::unique_ptr<RouterService> m_Service;
|
||||
std::unique_ptr<boost::asio::deadline_timer> m_PublishTimer, m_CongestionUpdateTimer, m_CleanupTimer;
|
||||
std::unique_ptr<boost::asio::steady_timer> m_PublishTimer, m_CongestionUpdateTimer, m_CleanupTimer;
|
||||
std::unordered_set<i2p::data::IdentHash> m_PublishExcluded;
|
||||
uint32_t m_PublishReplyToken;
|
||||
bool m_IsHiddenMode; // not publish
|
||||
|
||||
+9
-9
@@ -1085,7 +1085,7 @@ namespace transport
|
||||
|
||||
void SSU2Server::ScheduleTermination ()
|
||||
{
|
||||
m_TerminationTimer.expires_from_now (boost::posix_time::seconds(
|
||||
m_TerminationTimer.expires_after (std::chrono::seconds(
|
||||
SSU2_TERMINATION_CHECK_TIMEOUT + m_Rng () % SSU2_TERMINATION_CHECK_TIMEOUT_VARIANCE));
|
||||
m_TerminationTimer.async_wait (std::bind (&SSU2Server::HandleTerminationTimer,
|
||||
this, std::placeholders::_1));
|
||||
@@ -1133,7 +1133,7 @@ namespace transport
|
||||
|
||||
void SSU2Server::ScheduleCleanup ()
|
||||
{
|
||||
m_CleanupTimer.expires_from_now (boost::posix_time::seconds(SSU2_CLEANUP_INTERVAL));
|
||||
m_CleanupTimer.expires_after (std::chrono::seconds(SSU2_CLEANUP_INTERVAL));
|
||||
m_CleanupTimer.async_wait (std::bind (&SSU2Server::HandleCleanupTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ namespace transport
|
||||
|
||||
void SSU2Server::ScheduleResend (bool more)
|
||||
{
|
||||
m_ResendTimer.expires_from_now (boost::posix_time::milliseconds (more ?
|
||||
m_ResendTimer.expires_after (std::chrono::milliseconds (more ?
|
||||
(SSU2_RESEND_CHECK_MORE_TIMEOUT + m_Rng () % SSU2_RESEND_CHECK_MORE_TIMEOUT_VARIANCE):
|
||||
(SSU2_RESEND_CHECK_TIMEOUT + m_Rng () % SSU2_RESEND_CHECK_TIMEOUT_VARIANCE)));
|
||||
m_ResendTimer.async_wait (std::bind (&SSU2Server::HandleResendTimer,
|
||||
@@ -1442,7 +1442,7 @@ namespace transport
|
||||
{
|
||||
if (m_IsPublished)
|
||||
{
|
||||
m_IntroducersUpdateTimer.expires_from_now (boost::posix_time::seconds(
|
||||
m_IntroducersUpdateTimer.expires_after (std::chrono::seconds(
|
||||
SSU2_KEEP_ALIVE_INTERVAL + m_Rng () % SSU2_KEEP_ALIVE_INTERVAL_VARIANCE));
|
||||
m_IntroducersUpdateTimer.async_wait (std::bind (&SSU2Server::HandleIntroducersUpdateTimer,
|
||||
this, std::placeholders::_1, true));
|
||||
@@ -1456,7 +1456,7 @@ namespace transport
|
||||
m_IntroducersUpdateTimer.cancel ();
|
||||
i2p::context.ClearSSU2Introducers (true);
|
||||
m_Introducers.clear ();
|
||||
m_IntroducersUpdateTimer.expires_from_now (boost::posix_time::seconds(
|
||||
m_IntroducersUpdateTimer.expires_after (std::chrono::seconds(
|
||||
(SSU2_KEEP_ALIVE_INTERVAL + m_Rng () % SSU2_KEEP_ALIVE_INTERVAL_VARIANCE)/2));
|
||||
m_IntroducersUpdateTimer.async_wait (std::bind (&SSU2Server::HandleIntroducersUpdateTimer,
|
||||
this, std::placeholders::_1, true));
|
||||
@@ -1467,7 +1467,7 @@ namespace transport
|
||||
{
|
||||
if (m_IsPublished)
|
||||
{
|
||||
m_IntroducersUpdateTimerV6.expires_from_now (boost::posix_time::seconds(
|
||||
m_IntroducersUpdateTimerV6.expires_after (std::chrono::seconds(
|
||||
SSU2_KEEP_ALIVE_INTERVAL + m_Rng () % SSU2_KEEP_ALIVE_INTERVAL_VARIANCE));
|
||||
m_IntroducersUpdateTimerV6.async_wait (std::bind (&SSU2Server::HandleIntroducersUpdateTimer,
|
||||
this, std::placeholders::_1, false));
|
||||
@@ -1481,7 +1481,7 @@ namespace transport
|
||||
m_IntroducersUpdateTimerV6.cancel ();
|
||||
i2p::context.ClearSSU2Introducers (false);
|
||||
m_IntroducersV6.clear ();
|
||||
m_IntroducersUpdateTimerV6.expires_from_now (boost::posix_time::seconds(
|
||||
m_IntroducersUpdateTimerV6.expires_after (std::chrono::seconds(
|
||||
(SSU2_KEEP_ALIVE_INTERVAL + m_Rng () % SSU2_KEEP_ALIVE_INTERVAL_VARIANCE)/2));
|
||||
m_IntroducersUpdateTimerV6.async_wait (std::bind (&SSU2Server::HandleIntroducersUpdateTimer,
|
||||
this, std::placeholders::_1, false));
|
||||
@@ -1789,8 +1789,8 @@ namespace transport
|
||||
if (m_ProxyConnectRetryTimer)
|
||||
m_ProxyConnectRetryTimer->cancel ();
|
||||
else
|
||||
m_ProxyConnectRetryTimer.reset (new boost::asio::deadline_timer (m_ReceiveService.GetService ()));
|
||||
m_ProxyConnectRetryTimer->expires_from_now (boost::posix_time::seconds (SSU2_PROXY_CONNECT_RETRY_TIMEOUT));
|
||||
m_ProxyConnectRetryTimer.reset (new boost::asio::steady_timer (m_ReceiveService.GetService ()));
|
||||
m_ProxyConnectRetryTimer->expires_after (std::chrono::seconds (SSU2_PROXY_CONNECT_RETRY_TIMEOUT));
|
||||
m_ProxyConnectRetryTimer->async_wait (
|
||||
[this](const boost::system::error_code& ecode)
|
||||
{
|
||||
|
||||
+2
-2
@@ -198,7 +198,7 @@ namespace transport
|
||||
i2p::util::MemoryPool<SSU2SentPacket> m_SentPacketsPool;
|
||||
i2p::util::MemoryPool<SSU2IncompleteMessage> m_IncompleteMessagesPool;
|
||||
i2p::util::MemoryPool<SSU2IncompleteMessage::Fragment> m_FragmentsPool;
|
||||
boost::asio::deadline_timer m_TerminationTimer, m_CleanupTimer, m_ResendTimer,
|
||||
boost::asio::steady_timer m_TerminationTimer, m_CleanupTimer, m_ResendTimer,
|
||||
m_IntroducersUpdateTimer, m_IntroducersUpdateTimerV6;
|
||||
std::shared_ptr<SSU2Session> m_LastSession;
|
||||
bool m_IsPublished; // if we maintain introducers
|
||||
@@ -222,7 +222,7 @@ namespace transport
|
||||
std::unique_ptr<boost::asio::ip::tcp::endpoint> m_ProxyEndpoint;
|
||||
std::unique_ptr<boost::asio::ip::tcp::socket> m_UDPAssociateSocket;
|
||||
std::unique_ptr<boost::asio::ip::udp::endpoint> m_ProxyRelayEndpoint;
|
||||
std::unique_ptr<boost::asio::deadline_timer> m_ProxyConnectRetryTimer;
|
||||
std::unique_ptr<boost::asio::steady_timer> m_ProxyConnectRetryTimer;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace transport
|
||||
{
|
||||
if (m_NumResends < SSU2_PEER_TEST_MAX_NUM_RESENDS)
|
||||
{
|
||||
m_PeerTestResendTimer.expires_from_now (boost::posix_time::milliseconds(
|
||||
m_PeerTestResendTimer.expires_after (std::chrono::milliseconds(
|
||||
SSU2_PEER_TEST_RESEND_INTERVAL + GetServer ().GetRng ()() % SSU2_PEER_TEST_RESEND_INTERVAL_VARIANCE));
|
||||
std::weak_ptr<SSU2PeerTestSession> s(std::static_pointer_cast<SSU2PeerTestSession>(shared_from_this ()));
|
||||
m_PeerTestResendTimer.async_wait ([s, msg](const boost::system::error_code& ecode)
|
||||
@@ -322,7 +322,7 @@ namespace transport
|
||||
{
|
||||
if (m_NumResends < SSU2_HOLE_PUNCH_MAX_NUM_RESENDS)
|
||||
{
|
||||
m_HolePunchResendTimer.expires_from_now (boost::posix_time::milliseconds(
|
||||
m_HolePunchResendTimer.expires_after (std::chrono::milliseconds(
|
||||
SSU2_HOLE_PUNCH_RESEND_INTERVAL + GetServer ().GetRng ()() % SSU2_HOLE_PUNCH_RESEND_INTERVAL_VARIANCE));
|
||||
std::weak_ptr<SSU2HolePunchSession> s(std::static_pointer_cast<SSU2HolePunchSession>(shared_from_this ()));
|
||||
m_HolePunchResendTimer.async_wait ([s](const boost::system::error_code& ecode)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace transport
|
||||
uint8_t m_MsgNumReceived, m_NumResends;
|
||||
bool m_IsConnectedRecently, m_IsStatusChanged;
|
||||
std::vector<uint8_t> m_SignedData; // for resends
|
||||
boost::asio::deadline_timer m_PeerTestResendTimer;
|
||||
boost::asio::steady_timer m_PeerTestResendTimer;
|
||||
boost::asio::ip::udp::endpoint m_OurEndpoint; // as seen by peer
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace transport
|
||||
|
||||
int m_NumResends;
|
||||
std::vector<uint8_t> m_RelayResponseBlock;
|
||||
boost::asio::deadline_timer m_HolePunchResendTimer;
|
||||
boost::asio::steady_timer m_HolePunchResendTimer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace stream
|
||||
if (delayRequested < m_RTT)
|
||||
{
|
||||
m_IsAckSendScheduled = true;
|
||||
m_AckSendTimer.expires_from_now (boost::posix_time::milliseconds(delayRequested));
|
||||
m_AckSendTimer.expires_after (std::chrono::milliseconds(delayRequested));
|
||||
m_AckSendTimer.async_wait (std::bind (&Stream::HandleAckSendTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ namespace stream
|
||||
m_SendTimer.cancel ();
|
||||
uint64_t interval = SEND_INTERVAL + m_LocalDestination.GetRandom () % SEND_INTERVAL_VARIANCE;
|
||||
if (interval < m_PacingTime) interval = m_PacingTime;
|
||||
m_SendTimer.expires_from_now (boost::posix_time::microseconds(interval));
|
||||
m_SendTimer.expires_after (std::chrono::microseconds(interval));
|
||||
m_SendTimer.async_wait (std::bind (&Stream::HandleSendTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -1694,7 +1694,7 @@ namespace stream
|
||||
m_ResendTimer.cancel ();
|
||||
// check for invalid value
|
||||
if (m_RTO <= 0) m_RTO = INITIAL_RTO;
|
||||
m_ResendTimer.expires_from_now (boost::posix_time::milliseconds(m_RTO));
|
||||
m_ResendTimer.expires_after (std::chrono::milliseconds(m_RTO));
|
||||
m_ResendTimer.async_wait (std::bind (&Stream::HandleResendTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -1843,7 +1843,7 @@ namespace stream
|
||||
m_AckSendTimer.cancel ();
|
||||
m_IsAckSendScheduled = true;
|
||||
if (timeout < MIN_SEND_ACK_TIMEOUT) timeout = MIN_SEND_ACK_TIMEOUT;
|
||||
m_AckSendTimer.expires_from_now (boost::posix_time::milliseconds(timeout));
|
||||
m_AckSendTimer.expires_after (std::chrono::milliseconds(timeout));
|
||||
m_AckSendTimer.async_wait (std::bind (&Stream::HandleAckSendTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -2209,7 +2209,7 @@ namespace stream
|
||||
{
|
||||
m_PendingIncomingStreams.push_back (incomingStream);
|
||||
m_PendingIncomingTimer.cancel ();
|
||||
m_PendingIncomingTimer.expires_from_now (boost::posix_time::seconds(PENDING_INCOMING_TIMEOUT));
|
||||
m_PendingIncomingTimer.expires_after (std::chrono::seconds(PENDING_INCOMING_TIMEOUT));
|
||||
m_PendingIncomingTimer.async_wait (std::bind (&StreamingDestination::HandlePendingIncomingTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
LogPrint (eLogDebug, "Streaming: Pending incoming stream added, rSID=", receiveStreamID);
|
||||
@@ -2238,8 +2238,8 @@ namespace stream
|
||||
else
|
||||
{
|
||||
m_SavedPackets[receiveStreamID] = std::list<Packet *>{ packet };
|
||||
auto timer = std::make_shared<boost::asio::deadline_timer> (m_Owner->GetService ());
|
||||
timer->expires_from_now (boost::posix_time::seconds(PENDING_INCOMING_TIMEOUT));
|
||||
auto timer = std::make_shared<boost::asio::steady_timer> (m_Owner->GetService ());
|
||||
timer->expires_after (std::chrono::seconds(PENDING_INCOMING_TIMEOUT));
|
||||
auto s = shared_from_this ();
|
||||
timer->async_wait ([s,timer,receiveStreamID](const boost::system::error_code& ecode)
|
||||
{
|
||||
|
||||
+3
-3
@@ -290,7 +290,7 @@ namespace stream
|
||||
std::set<Packet *, PacketCmp> m_SavedPackets;
|
||||
std::set<Packet *, PacketCmp> m_SentPackets;
|
||||
std::set<Packet *, PacketCmp> m_NACKedPackets;
|
||||
boost::asio::deadline_timer m_ReceiveTimer, m_SendTimer, m_ResendTimer, m_AckSendTimer;
|
||||
boost::asio::steady_timer m_ReceiveTimer, m_SendTimer, m_ResendTimer, m_AckSendTimer;
|
||||
size_t m_NumSentBytes, m_NumReceivedBytes;
|
||||
uint16_t m_Port;
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace stream
|
||||
Acceptor m_Acceptor;
|
||||
PongHandler m_PongHandler;
|
||||
std::list<std::shared_ptr<Stream> > m_PendingIncomingStreams;
|
||||
boost::asio::deadline_timer m_PendingIncomingTimer;
|
||||
boost::asio::steady_timer m_PendingIncomingTimer;
|
||||
std::unordered_map<uint32_t, std::list<Packet *> > m_SavedPackets; // receiveStreamID->packets, arrived before SYN
|
||||
|
||||
uint64_t m_LastCleanupTime; // in seconds
|
||||
@@ -397,7 +397,7 @@ namespace stream
|
||||
else
|
||||
{
|
||||
int t = (timeout > MAX_RECEIVE_TIMEOUT) ? MAX_RECEIVE_TIMEOUT : timeout;
|
||||
s->m_ReceiveTimer.expires_from_now (boost::posix_time::seconds(t));
|
||||
s->m_ReceiveTimer.expires_after (std::chrono::seconds(t));
|
||||
int left = timeout - t;
|
||||
s->m_ReceiveTimer.async_wait (
|
||||
[s, buffer, handler, left](const boost::system::error_code & ec)
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace util
|
||||
|
||||
if (m_IsRunning)
|
||||
{
|
||||
m_Timer.expires_from_now (boost::posix_time::hours (m_SyncInterval));
|
||||
m_Timer.expires_after (std::chrono::hours (m_SyncInterval));
|
||||
m_Timer.async_wait ([this](const boost::system::error_code& ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp> // for boost 1.89
|
||||
#include <boost/asio/steady_timer.hpp> // for boost 1.89
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace util
|
||||
bool m_IsRunning;
|
||||
std::unique_ptr<std::thread> m_Thread;
|
||||
boost::asio::io_context m_Service;
|
||||
boost::asio::deadline_timer m_Timer;
|
||||
boost::asio::steady_timer m_Timer;
|
||||
int m_SyncInterval;
|
||||
std::vector<std::string> m_NTPServersList;
|
||||
};
|
||||
|
||||
+13
-13
@@ -184,9 +184,9 @@ namespace transport
|
||||
{
|
||||
m_Service = new boost::asio::io_context ();
|
||||
m_Work = new boost::asio::executor_work_guard<boost::asio::io_context::executor_type> (m_Service->get_executor ());
|
||||
m_PeerCleanupTimer = new boost::asio::deadline_timer (*m_Service);
|
||||
m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service);
|
||||
m_UpdateBandwidthTimer = new boost::asio::deadline_timer (*m_Service);
|
||||
m_PeerCleanupTimer = new boost::asio::steady_timer (*m_Service);
|
||||
m_PeerTestTimer = new boost::asio::steady_timer (*m_Service);
|
||||
m_UpdateBandwidthTimer = new boost::asio::steady_timer (*m_Service);
|
||||
m_BanListCleanupTimer = std::make_unique<boost::asio::steady_timer>(*m_Service);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace transport
|
||||
if (m_SSU2Server) m_SSU2Server->Start ();
|
||||
if (m_SSU2Server) DetectExternalIP ();
|
||||
|
||||
m_PeerCleanupTimer->expires_from_now (boost::posix_time::seconds(5 * SESSION_CREATION_TIMEOUT));
|
||||
m_PeerCleanupTimer->expires_after (std::chrono::seconds(5 * SESSION_CREATION_TIMEOUT));
|
||||
m_PeerCleanupTimer->async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1));
|
||||
|
||||
uint64_t ts = i2p::util::GetMillisecondsSinceEpoch();
|
||||
@@ -340,12 +340,12 @@ namespace transport
|
||||
}
|
||||
m_TrafficSamplePtr = TRAFFIC_SAMPLE_COUNT - 1;
|
||||
|
||||
m_UpdateBandwidthTimer->expires_from_now (boost::posix_time::seconds(1));
|
||||
m_UpdateBandwidthTimer->expires_after (std::chrono::seconds(1));
|
||||
m_UpdateBandwidthTimer->async_wait (std::bind (&Transports::HandleUpdateBandwidthTimer, this, std::placeholders::_1));
|
||||
|
||||
if (m_IsNAT)
|
||||
{
|
||||
m_PeerTestTimer->expires_from_now (boost::posix_time::seconds(PEER_TEST_INTERVAL + m_Rng() % PEER_TEST_INTERVAL_VARIANCE));
|
||||
m_PeerTestTimer->expires_after (std::chrono::seconds(PEER_TEST_INTERVAL + m_Rng() % PEER_TEST_INTERVAL_VARIANCE));
|
||||
m_PeerTestTimer->async_wait (std::bind (&Transports::HandlePeerTestTimer, this, std::placeholders::_1));
|
||||
}
|
||||
m_BanListCleanupTimer->expires_after (std::chrono::seconds(BAN_LIST_CLEANUP_INTERVAL + m_Rng () % BAN_LIST_CLEANUP_INTERVAL_VARIANCE));
|
||||
@@ -434,7 +434,7 @@ namespace transport
|
||||
UpdateBandwidthValues (15, m_InBandwidth15s, m_OutBandwidth15s, m_TransitBandwidth15s);
|
||||
UpdateBandwidthValues (300, m_InBandwidth5m, m_OutBandwidth5m, m_TransitBandwidth5m);
|
||||
|
||||
m_UpdateBandwidthTimer->expires_from_now (boost::posix_time::seconds(1));
|
||||
m_UpdateBandwidthTimer->expires_after (std::chrono::seconds(1));
|
||||
m_UpdateBandwidthTimer->async_wait (std::bind (&Transports::HandleUpdateBandwidthTimer, this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
@@ -828,8 +828,8 @@ namespace transport
|
||||
testDelay += PEER_TEST_DELAY_INTERVAL + m_Rng() % PEER_TEST_DELAY_INTERVAL_VARIANCE;
|
||||
if (m_Service)
|
||||
{
|
||||
auto delayTimer = std::make_shared<boost::asio::deadline_timer>(*m_Service);
|
||||
delayTimer->expires_from_now (boost::posix_time::milliseconds (testDelay));
|
||||
auto delayTimer = std::make_shared<boost::asio::steady_timer>(*m_Service);
|
||||
delayTimer->expires_after (std::chrono::milliseconds (testDelay));
|
||||
delayTimer->async_wait (
|
||||
[this, router, delayTimer](const boost::system::error_code& ecode)
|
||||
{
|
||||
@@ -866,8 +866,8 @@ namespace transport
|
||||
testDelay += PEER_TEST_DELAY_INTERVAL + m_Rng() % PEER_TEST_DELAY_INTERVAL_VARIANCE;
|
||||
if (m_Service)
|
||||
{
|
||||
auto delayTimer = std::make_shared<boost::asio::deadline_timer>(*m_Service);
|
||||
delayTimer->expires_from_now (boost::posix_time::milliseconds (testDelay));
|
||||
auto delayTimer = std::make_shared<boost::asio::steady_timer>(*m_Service);
|
||||
delayTimer->expires_after (std::chrono::milliseconds (testDelay));
|
||||
delayTimer->async_wait (
|
||||
[this, router, delayTimer](const boost::system::error_code& ecode)
|
||||
{
|
||||
@@ -1078,7 +1078,7 @@ namespace transport
|
||||
// if still testing or unknown, repeat peer test
|
||||
if (ipv4Testing || ipv6Testing)
|
||||
PeerTest (ipv4Testing, ipv6Testing);
|
||||
m_PeerCleanupTimer->expires_from_now (boost::posix_time::seconds(2 * SESSION_CREATION_TIMEOUT + m_Rng() % SESSION_CREATION_TIMEOUT));
|
||||
m_PeerCleanupTimer->expires_after (std::chrono::seconds(2 * SESSION_CREATION_TIMEOUT + m_Rng() % SESSION_CREATION_TIMEOUT));
|
||||
m_PeerCleanupTimer->async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
@@ -1088,7 +1088,7 @@ namespace transport
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
{
|
||||
PeerTest ();
|
||||
m_PeerTestTimer->expires_from_now (boost::posix_time::seconds(PEER_TEST_INTERVAL + m_Rng() % PEER_TEST_INTERVAL_VARIANCE));
|
||||
m_PeerTestTimer->expires_after (std::chrono::seconds(PEER_TEST_INTERVAL + m_Rng() % PEER_TEST_INTERVAL_VARIANCE));
|
||||
m_PeerTestTimer->async_wait (std::bind (&Transports::HandlePeerTestTimer, this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace transport
|
||||
std::thread * m_Thread;
|
||||
boost::asio::io_context * m_Service;
|
||||
boost::asio::executor_work_guard<boost::asio::io_context::executor_type> * m_Work;
|
||||
boost::asio::deadline_timer * m_PeerCleanupTimer, * m_PeerTestTimer, * m_UpdateBandwidthTimer;
|
||||
boost::asio::steady_timer * m_PeerCleanupTimer, * m_PeerTestTimer, * m_UpdateBandwidthTimer;
|
||||
|
||||
SSU2Server * m_SSU2Server;
|
||||
NTCP2Server * m_NTCP2Server;
|
||||
|
||||
@@ -866,8 +866,8 @@ namespace client
|
||||
SendReplyError ("No streaming destination");
|
||||
return;
|
||||
}
|
||||
auto timer = std::make_shared<boost::asio::deadline_timer>(localDestination->GetService ());
|
||||
timer->expires_from_now (boost::posix_time::milliseconds(BOB_PING_TIMEOUT));
|
||||
auto timer = std::make_shared<boost::asio::steady_timer>(localDestination->GetService ());
|
||||
timer->expires_after (std::chrono::milliseconds(BOB_PING_TIMEOUT));
|
||||
timer->async_wait ([streamingDestination, s = shared_from_this ()](const boost::system::error_code& ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace client
|
||||
// start UDP cleanup
|
||||
if (!m_ServerForwards.empty ())
|
||||
{
|
||||
m_CleanupUDPTimer.reset (new boost::asio::deadline_timer(m_SharedLocalDestination->GetService ()));
|
||||
m_CleanupUDPTimer.reset (new boost::asio::steady_timer(m_SharedLocalDestination->GetService ()));
|
||||
ScheduleCleanupUDP();
|
||||
}
|
||||
}
|
||||
@@ -1043,7 +1043,7 @@ namespace client
|
||||
if (m_CleanupUDPTimer)
|
||||
{
|
||||
// schedule cleanup in 17 seconds
|
||||
m_CleanupUDPTimer->expires_from_now (boost::posix_time::seconds (17));
|
||||
m_CleanupUDPTimer->expires_after (std::chrono::seconds (17));
|
||||
m_CleanupUDPTimer->async_wait(std::bind(&ClientContext::CleanupUDP, this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace client
|
||||
BOBCommandChannel * m_BOBCommandChannel;
|
||||
I2CPServer * m_I2CPServer;
|
||||
|
||||
std::unique_ptr<boost::asio::deadline_timer> m_CleanupUDPTimer;
|
||||
std::unique_ptr<boost::asio::steady_timer> m_CleanupUDPTimer;
|
||||
|
||||
// i18n
|
||||
std::shared_ptr<const i2p::i18n::Locale> m_Language;
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace client
|
||||
if (!pool || pool->GetOutboundTunnels ().empty ())
|
||||
{
|
||||
// try again later
|
||||
m_ReadinessCheckTimer.expires_from_now (boost::posix_time::seconds(I2CP_DESTINATION_READINESS_CHECK_INTERVAL));
|
||||
m_ReadinessCheckTimer.expires_after (std::chrono::seconds(I2CP_DESTINATION_READINESS_CHECK_INTERVAL));
|
||||
m_ReadinessCheckTimer.async_wait(
|
||||
[s=GetSharedFromThis (), tunnels=std::move(tunnels)](const boost::system::error_code& ecode)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ namespace client
|
||||
htobe16buf (leases - 3, sessionID);
|
||||
size_t l = 2/*sessionID*/ + 1/*num leases*/ + i2p::data::LEASE_SIZE*numLeases;
|
||||
m_Owner->SendI2CPMessage (I2CP_REQUEST_VARIABLE_LEASESET_MESSAGE, leases - 3, l);
|
||||
m_LeaseSetCreationTimer.expires_from_now (boost::posix_time::seconds (I2CP_LEASESET_CREATION_TIMEOUT));
|
||||
m_LeaseSetCreationTimer.expires_after (std::chrono::seconds (I2CP_LEASESET_CREATION_TIMEOUT));
|
||||
auto s = GetSharedFromThis ();
|
||||
m_LeaseSetCreationTimer.async_wait ([s](const boost::system::error_code& ecode)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace client
|
||||
std::map<i2p::data::CryptoKeyType, std::shared_ptr<i2p::crypto::LocalEncryptionKey> > m_EncryptionKeys; // last is most preferable
|
||||
uint64_t m_LeaseSetExpirationTime;
|
||||
bool m_IsCreatingLeaseSet, m_IsSameThread;
|
||||
boost::asio::deadline_timer m_LeaseSetCreationTimer, m_ReadinessCheckTimer;
|
||||
boost::asio::steady_timer m_LeaseSetCreationTimer, m_ReadinessCheckTimer;
|
||||
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_MAX_MESSAGE_SIZE> > m_I2NPMsgsPool;
|
||||
};
|
||||
|
||||
|
||||
@@ -693,7 +693,7 @@ namespace client
|
||||
{
|
||||
m_KeepAliveInterval = keepAliveInterval;
|
||||
if (m_KeepAliveInterval)
|
||||
m_KeepAliveTimer.reset (new boost::asio::deadline_timer (GetLocalDestination ()->GetService ()));
|
||||
m_KeepAliveTimer.reset (new boost::asio::steady_timer (GetLocalDestination ()->GetService ()));
|
||||
}
|
||||
|
||||
/* HACK: maybe we should create a caching IdentHash provider in AddressBook */
|
||||
@@ -721,7 +721,7 @@ namespace client
|
||||
{
|
||||
if (m_KeepAliveTimer)
|
||||
{
|
||||
m_KeepAliveTimer->expires_from_now (boost::posix_time::seconds (m_KeepAliveInterval));
|
||||
m_KeepAliveTimer->expires_after (std::chrono::seconds (m_KeepAliveInterval));
|
||||
m_KeepAliveTimer->async_wait (std::bind (&I2PClientTunnel::HandleKeepAliveTimer,
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace client
|
||||
std::shared_ptr<const Address> m_Address;
|
||||
uint16_t m_DestinationPort;
|
||||
uint32_t m_KeepAliveInterval;
|
||||
std::unique_ptr<boost::asio::deadline_timer> m_KeepAliveTimer;
|
||||
std::unique_ptr<boost::asio::steady_timer> m_KeepAliveTimer;
|
||||
};
|
||||
|
||||
class I2PServerTunnel: public I2PService
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace client
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResolveTimer->expires_from_now(boost::posix_time::seconds(1));
|
||||
m_ResolveTimer->expires_after(std::chrono::seconds(1));
|
||||
m_ResolveTimer->async_wait([&](const boost::system::error_code & ec) {
|
||||
if(!ec) ResolveCurrentLeaseSet();
|
||||
});
|
||||
@@ -57,7 +57,7 @@ namespace client
|
||||
void MatchedTunnelDestination::Start()
|
||||
{
|
||||
ClientDestination::Start();
|
||||
m_ResolveTimer = std::make_shared<boost::asio::deadline_timer>(GetService());
|
||||
m_ResolveTimer = std::make_shared<boost::asio::steady_timer>(GetService());
|
||||
GetTunnelPool()->SetCustomPeerSelector(this);
|
||||
ResolveCurrentLeaseSet();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace client
|
||||
std::string m_RemoteName;
|
||||
i2p::data::IdentHash m_RemoteIdent;
|
||||
std::shared_ptr<const i2p::data::LeaseSet> m_RemoteLeaseSet;
|
||||
std::shared_ptr<boost::asio::deadline_timer> m_ResolveTimer;
|
||||
std::shared_ptr<boost::asio::steady_timer> m_ResolveTimer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace client
|
||||
SendSessionCreateReplyOk ();
|
||||
else
|
||||
{
|
||||
m_Timer.expires_from_now (boost::posix_time::seconds(SAM_SESSION_READINESS_CHECK_INTERVAL));
|
||||
m_Timer.expires_after (std::chrono::seconds(SAM_SESSION_READINESS_CHECK_INTERVAL));
|
||||
m_Timer.async_wait (std::bind (&SAMSocket::HandleSessionReadinessCheckTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -497,7 +497,7 @@ namespace client
|
||||
SendSessionCreateReplyOk ();
|
||||
else
|
||||
{
|
||||
m_Timer.expires_from_now (boost::posix_time::seconds(SAM_SESSION_READINESS_CHECK_INTERVAL));
|
||||
m_Timer.expires_after (std::chrono::seconds(SAM_SESSION_READINESS_CHECK_INTERVAL));
|
||||
m_Timer.async_wait (std::bind (&SAMSocket::HandleSessionReadinessCheckTimer,
|
||||
shared_from_this (), std::placeholders::_1));
|
||||
}
|
||||
@@ -1591,13 +1591,13 @@ namespace client
|
||||
|
||||
void SAMBridge::ScheduleSessionCleanupTimer (std::shared_ptr<SAMSession> session)
|
||||
{
|
||||
auto timer = std::make_shared<boost::asio::deadline_timer>(GetService ());
|
||||
timer->expires_from_now (boost::posix_time::seconds(5)); // postpone destination clean for 5 seconds
|
||||
auto timer = std::make_shared<boost::asio::steady_timer>(GetService ());
|
||||
timer->expires_after (std::chrono::seconds(5)); // postpone destination clean for 5 seconds
|
||||
timer->async_wait (std::bind (&SAMBridge::HandleSessionCleanupTimer, this, std::placeholders::_1, session, timer));
|
||||
}
|
||||
|
||||
void SAMBridge::HandleSessionCleanupTimer (const boost::system::error_code& ecode,
|
||||
std::shared_ptr<SAMSession> session, std::shared_ptr<boost::asio::deadline_timer> timer)
|
||||
std::shared_ptr<SAMSession> session, std::shared_ptr<boost::asio::steady_timer> timer)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted && session)
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace client
|
||||
|
||||
SAMBridge& m_Owner;
|
||||
Socket_t m_Socket;
|
||||
boost::asio::deadline_timer m_Timer;
|
||||
boost::asio::steady_timer m_Timer;
|
||||
char m_Buffer[SAM_SOCKET_BUFFER_SIZE + 1];
|
||||
size_t m_BufferOffset; // for session only
|
||||
uint8_t m_StreamBuffer[SAM_STREAM_BUFFER_SIZE];
|
||||
@@ -294,7 +294,7 @@ namespace client
|
||||
|
||||
void ScheduleSessionCleanupTimer (std::shared_ptr<SAMSession> session);
|
||||
void HandleSessionCleanupTimer (const boost::system::error_code& ecode,
|
||||
std::shared_ptr<SAMSession> session, std::shared_ptr<boost::asio::deadline_timer> timer);
|
||||
std::shared_ptr<SAMSession> session, std::shared_ptr<boost::asio::steady_timer> timer);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace client
|
||||
if (!m_AckTimerSeqn)
|
||||
{
|
||||
m_AckTimerSeqn = seqn;
|
||||
m_AckTimer.expires_from_now (boost::posix_time::milliseconds (m_RTT ? 2*m_RTT : I2P_UDP_MAX_UNACKED_DATAGRAM_TIME));
|
||||
m_AckTimer.expires_after (std::chrono::milliseconds (m_RTT ? 2*m_RTT : I2P_UDP_MAX_UNACKED_DATAGRAM_TIME));
|
||||
m_AckTimer.async_wait ([this](const boost::system::error_code& ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace client
|
||||
std::list<std::pair<uint32_t, uint64_t> > m_UnackedDatagrams; // list of sent but not acked repliable datagrams(seqn, timestamp) in ascending order
|
||||
uint64_t m_RTT = 0; // milliseconds
|
||||
|
||||
boost::asio::deadline_timer m_AckTimer;
|
||||
boost::asio::steady_timer m_AckTimer;
|
||||
uint32_t m_AckTimerSeqn = 0;
|
||||
bool m_IsSendingAllowed = true;
|
||||
bool m_IsFirstPacket = true;
|
||||
|
||||
Reference in New Issue
Block a user