mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Destroy I2PControlSession before io_service, cancel waiting operations.
This commit is contained in:
@@ -11,11 +11,12 @@ namespace i2p
|
||||
namespace client
|
||||
{
|
||||
I2PControlService::I2PControlService(const std::string& address, int port)
|
||||
: m_Session(m_Service), m_IsRunning(false), m_Thread(nullptr),
|
||||
: m_Session(new I2PControlSession(m_Service)), m_IsRunning(false), m_Thread(nullptr),
|
||||
m_Acceptor(m_Service, boost::asio::ip::tcp::endpoint(
|
||||
boost::asio::ip::address::from_string(address), port)
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
I2PControlService::~I2PControlService ()
|
||||
@@ -39,6 +40,8 @@ namespace client
|
||||
{
|
||||
m_IsRunning = false;
|
||||
m_Acceptor.cancel ();
|
||||
// Delete the session before the io_service is stopped and destroyed
|
||||
delete m_Session;
|
||||
m_Service.stop ();
|
||||
if (m_Thread)
|
||||
{
|
||||
@@ -126,7 +129,7 @@ namespace client
|
||||
}
|
||||
}
|
||||
|
||||
I2PControlSession::Response response = m_Session.handleRequest(ss);
|
||||
I2PControlSession::Response response = m_Session->handleRequest(ss);
|
||||
SendResponse(socket, buf, response.toJsonString(), isHtml);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
|
||||
Reference in New Issue
Block a user