mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-30 12:47:48 +02:00
Destroy I2PControlSession before io_service, cancel waiting operations.
This commit is contained in:
parent
9cca01d159
commit
c7f4a79b2c
4 changed files with 28 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue