diff options
Diffstat (limited to '')
-rw-r--r-- | src/p2p/connection_basic.cpp | 17 | ||||
-rw-r--r-- | src/p2p/connection_basic.hpp | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/p2p/connection_basic.cpp b/src/p2p/connection_basic.cpp index 0454f30e3..adf159dc0 100644 --- a/src/p2p/connection_basic.cpp +++ b/src/p2p/connection_basic.cpp @@ -199,6 +199,23 @@ void connection_basic::set_rate_down_limit(uint64_t limit) { save_limit_to_file(limit); } +uint64_t connection_basic::get_rate_up_limit() { + uint64_t limit; + { + CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out ); + limit = network_throttle_manager::get_global_throttle_out().get_terget_speed(); + } + return limit; +} + +uint64_t connection_basic::get_rate_down_limit() { + uint64_t limit; + { + CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_in ); + limit = network_throttle_manager::get_global_throttle_in().get_terget_speed(); + } + return limit; +} void connection_basic::save_limit_to_file(int limit) { // saving limit to file diff --git a/src/p2p/connection_basic.hpp b/src/p2p/connection_basic.hpp index d8101afe4..945cd982c 100644 --- a/src/p2p/connection_basic.hpp +++ b/src/p2p/connection_basic.hpp @@ -119,6 +119,8 @@ class connection_basic { // not-templated base class for rapid developmet of som static void set_rate_up_limit(uint64_t limit); static void set_rate_down_limit(uint64_t limit); + static uint64_t get_rate_up_limit(); + static uint64_t get_rate_down_limit(); // config misc static void set_tos_flag(int tos); // ToS / QoS flag |