Merge pull request #5911

e48dcb7 levin: armour against some 'should not happen' case (moneromooo-monero)
This commit is contained in:
luigi1111 2019-10-16 13:35:55 -05:00
commit 7ec8d9640e
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -272,6 +272,11 @@ public:
bool add_invoke_response_handler(const callback_t &cb, uint64_t timeout, async_protocol_handler& con, int command) bool add_invoke_response_handler(const callback_t &cb, uint64_t timeout, async_protocol_handler& con, int command)
{ {
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock); CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
if (m_protocol_released)
{
MERROR("Adding response handler to a released object");
return false;
}
boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<anvoke_handler<callback_t>>(cb, timeout, con, command)); boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<anvoke_handler<callback_t>>(cb, timeout, con, command));
m_invoke_response_handlers.push_back(handler); m_invoke_response_handlers.push_back(handler);
return handler->is_timer_started(); return handler->is_timer_started();