|
|
|
@ -335,20 +335,18 @@ namespace proxy {
@@ -335,20 +335,18 @@ namespace proxy {
|
|
|
|
|
|
|
|
|
|
void HTTPReqHandler::HandleStreamRequestComplete (std::shared_ptr<i2p::stream::Stream> stream) |
|
|
|
|
{ |
|
|
|
|
if (stream) |
|
|
|
|
{ |
|
|
|
|
if (Kill()) return; |
|
|
|
|
LogPrint (eLogInfo, "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 |
|
|
|
|
{ |
|
|
|
|
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()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HTTPProxy::HTTPProxy(const std::string& address, int port, std::shared_ptr<i2p::client::ClientDestination> localDestination): |
|
|
|
|