|
|
|
@ -335,21 +335,19 @@ namespace proxy {
@@ -335,21 +335,19 @@ namespace proxy {
|
|
|
|
|
|
|
|
|
|
void HTTPReqHandler::HandleStreamRequestComplete (std::shared_ptr<i2p::stream::Stream> stream) |
|
|
|
|
{ |
|
|
|
|
if (stream) |
|
|
|
|
{ |
|
|
|
|
if (Kill()) return; |
|
|
|
|
LogPrint (eLogInfo, "HTTPProxy: New I2PTunnel connection"); |
|
|
|
|
if (!stream) { |
|
|
|
|
LogPrint (eLogError, "HTTPProxy: error when creating the stream, check the previous warnings for more info"); |
|
|
|
|
HTTPRequestFailed("error when creating the stream, check logs"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (Kill()) |
|
|
|
|
return; |
|
|
|
|
LogPrint (eLogDebug, "HTTPProxy: New I2PTunnel connection"); |
|
|
|
|
auto connection = std::make_shared<i2p::client::I2PTunnelConnection>(GetOwner(), m_sock, stream); |
|
|
|
|
GetOwner()->AddHandler (connection); |
|
|
|
|
connection->I2PConnect (reinterpret_cast<const uint8_t*>(m_request.data()), m_request.size()); |
|
|
|
|
Done (shared_from_this()); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
LogPrint (eLogError, "HTTPProxy: error when creating the stream, check the previous warnings for more info"); |
|
|
|
|
HTTPRequestFailed("error when creating the stream, check logs"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HTTPProxy::HTTPProxy(const std::string& address, int port, std::shared_ptr<i2p::client::ClientDestination> localDestination): |
|
|
|
|
TCPIPAcceptor(address, port, localDestination ? localDestination : i2p::client::context.GetSharedLocalDestination ()) |
|
|
|
|