mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
use shared_ptr for socket in I2PTunnelConnection
This commit is contained in:
parent
fbe4e64e44
commit
e72eb35cc2
10 changed files with 33 additions and 43 deletions
|
@ -44,7 +44,7 @@ namespace proxy
|
|||
void HandleStreamRequestComplete (std::shared_ptr<i2p::stream::Stream> stream);
|
||||
|
||||
uint8_t m_http_buff[http_buffer_size];
|
||||
boost::asio::ip::tcp::socket * m_sock;
|
||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_sock;
|
||||
std::string m_request; //Data left to be sent
|
||||
std::string m_url; //URL
|
||||
std::string m_method; //Method
|
||||
|
@ -56,7 +56,7 @@ namespace proxy
|
|||
|
||||
public:
|
||||
|
||||
HTTPProxyHandler(HTTPProxyServer * parent, boost::asio::ip::tcp::socket * sock) :
|
||||
HTTPProxyHandler(HTTPProxyServer * parent, std::shared_ptr<boost::asio::ip::tcp::socket> sock) :
|
||||
I2PServiceHandler(parent), m_sock(sock)
|
||||
{ EnterState(GET_METHOD); }
|
||||
~HTTPProxyHandler() { Terminate(); }
|
||||
|
@ -77,10 +77,10 @@ namespace proxy
|
|||
|
||||
void HTTPProxyHandler::Terminate() {
|
||||
if (Kill()) return;
|
||||
if (m_sock) {
|
||||
if (m_sock)
|
||||
{
|
||||
LogPrint(eLogDebug,"--- HTTP Proxy close sock");
|
||||
m_sock->close();
|
||||
delete m_sock;
|
||||
m_sock = nullptr;
|
||||
}
|
||||
Done(shared_from_this());
|
||||
|
@ -290,7 +290,7 @@ namespace proxy
|
|||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<i2p::client::I2PServiceHandler> HTTPProxyServer::CreateHandler(boost::asio::ip::tcp::socket * socket)
|
||||
std::shared_ptr<i2p::client::I2PServiceHandler> HTTPProxyServer::CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket)
|
||||
{
|
||||
return std::make_shared<HTTPProxyHandler> (this, socket);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue