diff --git a/BOB.cpp b/BOB.cpp index 2f881a69..edf6995e 100644 --- a/BOB.cpp +++ b/BOB.cpp @@ -10,7 +10,7 @@ namespace client { BOBI2PInboundTunnel::BOBI2PInboundTunnel (int port, std::shared_ptr localDestination): BOBI2PTunnel (localDestination), - m_Acceptor (localDestination->GetService (), boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)), m_Timer (localDestination->GetService ()) + m_Acceptor (localDestination->GetService (), boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)) { } @@ -94,12 +94,9 @@ namespace client if (leaseSet) CreateConnection (receiver, leaseSet); else - { - GetLocalDestination ()->RequestDestination (ident); - m_Timer.expires_from_now (boost::posix_time::seconds (I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT)); - m_Timer.async_wait (std::bind (&BOBI2PInboundTunnel::HandleDestinationRequestTimer, + GetLocalDestination ()->RequestDestination (ident, + std::bind (&BOBI2PInboundTunnel::HandleDestinationRequestComplete, this, std::placeholders::_1, receiver, ident)); - } } else { @@ -115,9 +112,9 @@ namespace client } } - void BOBI2PInboundTunnel::HandleDestinationRequestTimer (const boost::system::error_code& ecode, AddressReceiver * receiver, i2p::data::IdentHash ident) + void BOBI2PInboundTunnel::HandleDestinationRequestComplete (bool success, AddressReceiver * receiver, i2p::data::IdentHash ident) { - if (ecode != boost::asio::error::operation_aborted) + if (success) { auto leaseSet = GetLocalDestination ()->FindLeaseSet (ident); if (leaseSet) diff --git a/BOB.h b/BOB.h index cd42c9b8..5bd4c24a 100644 --- a/BOB.h +++ b/BOB.h @@ -82,14 +82,13 @@ namespace client void HandleReceivedAddress (const boost::system::error_code& ecode, std::size_t bytes_transferred, AddressReceiver * receiver); - void HandleDestinationRequestTimer (const boost::system::error_code& ecode, AddressReceiver * receiver, i2p::data::IdentHash ident); + void HandleDestinationRequestComplete (bool success, AddressReceiver * receiver, i2p::data::IdentHash ident); void CreateConnection (AddressReceiver * receiver, std::shared_ptr leaseSet); private: boost::asio::ip::tcp::acceptor m_Acceptor; - boost::asio::deadline_timer m_Timer; }; class BOBI2POutboundTunnel: public BOBI2PTunnel