From da01ea997d6c61ae5509aeb8a1bae5bbc79d13ea Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 27 Dec 2014 10:09:55 -0500 Subject: [PATCH] wait from LeaseSet request comlete --- I2PTunnel.cpp | 9 ++++----- I2PTunnel.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index a031b322..46e1b4bb 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -213,9 +213,8 @@ namespace client CreateConnection (socket); else { - GetLocalDestination ()->RequestDestination (*m_DestinationIdentHash); - m_Timer.expires_from_now (boost::posix_time::seconds (I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT)); - m_Timer.async_wait (std::bind (&I2PClientTunnel::HandleDestinationRequestTimer, + GetLocalDestination ()->RequestDestination (*m_DestinationIdentHash, + std::bind (&I2PClientTunnel::HandleLeaseSetRequestComplete, this, std::placeholders::_1, socket)); } } @@ -231,9 +230,9 @@ namespace client delete socket; } - void I2PClientTunnel::HandleDestinationRequestTimer (const boost::system::error_code& ecode, boost::asio::ip::tcp::socket * socket) + void I2PClientTunnel::HandleLeaseSetRequestComplete (bool success, boost::asio::ip::tcp::socket * socket) { - if (ecode != boost::asio::error::operation_aborted) + if (success) { if (m_DestinationIdentHash) { diff --git a/I2PTunnel.h b/I2PTunnel.h index 9c70cf23..b63b4a9f 100644 --- a/I2PTunnel.h +++ b/I2PTunnel.h @@ -92,7 +92,7 @@ namespace client void Accept (); void HandleAccept (const boost::system::error_code& ecode, boost::asio::ip::tcp::socket * socket); - void HandleDestinationRequestTimer (const boost::system::error_code& ecode, boost::asio::ip::tcp::socket * socket); + void HandleLeaseSetRequestComplete (bool success, boost::asio::ip::tcp::socket * socket); void CreateConnection (boost::asio::ip::tcp::socket * socket); private: