diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-07 15:24:58 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-07 15:24:58 +0200 |
commit | 6db8a60a18c3678824016234b2153b4b0f0dbbdd (patch) | |
tree | 7a36b079ad838f6d8046844e3a7596027f12bfdf /contrib/epee/include/net/levin_protocol_handler_async.h | |
parent | Merge pull request #2138 (diff) | |
parent | core: thread most of handle_incoming_tx (diff) | |
download | monero-6db8a60a18c3678824016234b2153b4b0f0dbbdd.tar.xz |
Merge pull request #2149
158c3ecf core: thread most of handle_incoming_tx (moneromooo-monero)
f57ee382 cryptonote_protocol: retry stale spans early (moneromooo-monero)
90df52e1 cryptonote_protocol: light cleanup (moneromooo-monero)
84e23156 cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages (moneromooo-monero)
5be43fcd cryptonote_protocol_handler: sync speedup (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include/net/levin_protocol_handler_async.h')
-rw-r--r-- | contrib/epee/include/net/levin_protocol_handler_async.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index 8aa0faba1..60a667690 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -88,6 +88,8 @@ public: bool request_callback(boost::uuids::uuid connection_id); template<class callback_t> bool foreach_connection(callback_t cb); + template<class callback_t> + bool for_connection(const boost::uuids::uuid &connection_id, callback_t cb); size_t get_connections_count(); async_protocol_handler_config():m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE) @@ -804,6 +806,18 @@ bool async_protocol_handler_config<t_connection_context>::foreach_connection(cal return true; } //------------------------------------------------------------------------------------------ +template<class t_connection_context> template<class callback_t> +bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, callback_t cb) +{ + CRITICAL_REGION_LOCAL(m_connects_lock); + async_protocol_handler<t_connection_context>* aph = find_connection(connection_id); + if (!aph) + return false; + if(!cb(aph->get_context_ref())) + return false; + return true; +} +//------------------------------------------------------------------------------------------ template<class t_connection_context> size_t async_protocol_handler_config<t_connection_context>::get_connections_count() { |