diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-07-24 14:08:52 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-07-24 14:08:52 -0500 |
commit | 38e0e58a95d2c5726a1b9bf1a2261ec96ed412e1 (patch) | |
tree | dcef99ba73db525c78d908dd7ac6b259c5cd7788 /contrib | |
parent | Merge pull request #5530 (diff) | |
parent | abstract_tcp_server2: move some things out of a lock (diff) | |
download | monero-38e0e58a95d2c5726a1b9bf1a2261ec96ed412e1.tar.xz |
Merge pull request #5531
9a6006b abstract_tcp_server2: move some things out of a lock (moneromooo-monero)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index fa5858b9f..0721366aa 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -327,12 +327,14 @@ PRAGMA_WARNING_DISABLE_VS(4355) if (!e) { + double current_speed_down; { CRITICAL_REGION_LOCAL(m_throttle_speed_in_mutex); m_throttle_speed_in.handle_trafic_exact(bytes_transferred); - context.m_current_speed_down = m_throttle_speed_in.get_current_speed(); - context.m_max_speed_down = std::max(context.m_max_speed_down, context.m_current_speed_down); + current_speed_down = m_throttle_speed_in.get_current_speed(); } + context.m_current_speed_down = current_speed_down; + context.m_max_speed_down = std::max(context.m_max_speed_down, current_speed_down); { CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::network_throttle_manager::m_lock_get_global_throttle_in ); @@ -602,12 +604,14 @@ PRAGMA_WARNING_DISABLE_VS(4355) return false; if(m_was_shutdown) return false; + double current_speed_up; { CRITICAL_REGION_LOCAL(m_throttle_speed_out_mutex); m_throttle_speed_out.handle_trafic_exact(cb); - context.m_current_speed_up = m_throttle_speed_out.get_current_speed(); - context.m_max_speed_up = std::max(context.m_max_speed_up, context.m_current_speed_up); + current_speed_up = m_throttle_speed_out.get_current_speed(); } + context.m_current_speed_up = current_speed_up; + context.m_max_speed_up = std::max(context.m_max_speed_up, current_speed_up); //_info("[sock " << socket().native_handle() << "] SEND " << cb); context.m_last_send = time(NULL); |