|
|
@ -10,7 +10,7 @@ namespace client |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOBI2PInboundTunnel::BOBI2PInboundTunnel (int port, std::shared_ptr<ClientDestination> localDestination): |
|
|
|
BOBI2PInboundTunnel::BOBI2PInboundTunnel (int port, std::shared_ptr<ClientDestination> localDestination): |
|
|
|
BOBI2PTunnel (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,13 +94,10 @@ namespace client |
|
|
|
if (leaseSet) |
|
|
|
if (leaseSet) |
|
|
|
CreateConnection (receiver, leaseSet); |
|
|
|
CreateConnection (receiver, leaseSet); |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
GetLocalDestination ()->RequestDestination (ident, |
|
|
|
GetLocalDestination ()->RequestDestination (ident); |
|
|
|
std::bind (&BOBI2PInboundTunnel::HandleDestinationRequestComplete, |
|
|
|
m_Timer.expires_from_now (boost::posix_time::seconds (I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT)); |
|
|
|
|
|
|
|
m_Timer.async_wait (std::bind (&BOBI2PInboundTunnel::HandleDestinationRequestTimer, |
|
|
|
|
|
|
|
this, std::placeholders::_1, receiver, ident)); |
|
|
|
this, std::placeholders::_1, receiver, ident)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (receiver->bufferOffset < BOB_COMMAND_BUFFER_SIZE) |
|
|
|
if (receiver->bufferOffset < BOB_COMMAND_BUFFER_SIZE) |
|
|
@ -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); |
|
|
|
auto leaseSet = GetLocalDestination ()->FindLeaseSet (ident); |
|
|
|
if (leaseSet) |
|
|
|
if (leaseSet) |
|
|
|