aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-15 10:27:44 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-15 10:47:45 +0000
commit7f4bb612fb4088c57fe6eeb941004ec394eaad6d (patch)
tree7fb444c55dcd2323e6624e14e31626df6825a31a /contrib/epee/include
parentMerge pull request #2906 (diff)
downloadmonero-7f4bb612fb4088c57fe6eeb941004ec394eaad6d.tar.xz
levin_protocol_handler_async: add missing response handler locking
Diffstat (limited to 'contrib/epee/include')
-rw-r--r--contrib/epee/include/net/levin_protocol_handler_async.h14
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 7ad6d198b..2e320ac8d 100644
--- a/contrib/epee/include/net/levin_protocol_handler_async.h
+++ b/contrib/epee/include/net/levin_protocol_handler_async.h
@@ -376,12 +376,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;
}