Browse Source

fixed memory leak

pull/113/head
orignal 10 years ago
parent
commit
9539fb8cb0
  1. 13
      HTTPServer.cpp

13
HTTPServer.cpp

@ -514,15 +514,17 @@ namespace util @@ -514,15 +514,17 @@ namespace util
void HTTPConnection::Terminate ()
{
if (!m_Stream || !m_Stream->IsOpen ()) return;
if (m_Stream)
if (!m_Stream) return;
m_Socket->close ();
if (m_Stream->IsOpen ())
m_Stream->Close ();
m_Socket->close ();
m_Socket->get_io_service ().post ([=](void)
{
i2p::stream::DeleteStream (m_Stream);
//delete this;
m_Stream.reset ();
m_Stream = nullptr;
// delete this
});
}
@ -604,8 +606,11 @@ namespace util @@ -604,8 +606,11 @@ namespace util
void HTTPConnection::HandleWriteReply (const boost::system::error_code& ecode)
{
if (ecode != boost::asio::error::operation_aborted)
{
m_Socket->close ();
Terminate ();
}
}
void HTTPConnection::HandleWrite (const boost::system::error_code& ecode)
{

Loading…
Cancel
Save