diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-12-25 21:20:41 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-12-25 21:20:41 +0200 |
commit | effdc82b58e57e6baf185b8e14a6b4bb08c5feab (patch) | |
tree | c01978b2921d3ac804d4a198d160d8d9cb5e873f /contrib | |
parent | Merge pull request #2929 (diff) | |
parent | levin_protocol_handler_async: add missing response handler locking (diff) | |
download | monero-effdc82b58e57e6baf185b8e14a6b4bb08c5feab.tar.xz |
Merge pull request #2930
7f4bb612 levin_protocol_handler_async: add missing response handler locking (moneromooo-monero)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/net/levin_protocol_handler_async.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index ae6622a29..65705351d 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -379,12 +379,16 @@ public: if(m_cache_in_buffer.size() < m_current_head.m_cb) { is_continue = false; - if(cb >= MIN_BYTES_WANTED && !m_invoke_response_handlers.empty()) + if(cb >= MIN_BYTES_WANTED) { - //async call scenario - boost::shared_ptr<invoke_response_handler_base> response_handler = m_invoke_response_handlers.front(); - response_handler->reset_timer(); - MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb); + CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock); + if (!m_invoke_response_handlers.empty()) + { + //async call scenario + boost::shared_ptr<invoke_response_handler_base> response_handler = m_invoke_response_handlers.front(); + response_handler->reset_timer(); + MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb); + } } break; } |