aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/network_throttle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/p2p/network_throttle.cpp')
-rw-r--r--src/p2p/network_throttle.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/p2p/network_throttle.cpp b/src/p2p/network_throttle.cpp
index 6d68f3286..74b20376d 100644
--- a/src/p2p/network_throttle.cpp
+++ b/src/p2p/network_throttle.cpp
@@ -54,7 +54,7 @@ Throttling work by:
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "../../src/p2p/network_throttle-detail.hpp"
+#include "network_throttle-detail.hpp"
namespace epee
{
@@ -77,28 +77,22 @@ int network_throttle_manager::xxx;
// ================================================================================================
// methods:
i_network_throttle & network_throttle_manager::get_global_throttle_in() {
- boost::call_once(m_once_get_global_throttle_in, [] { m_obj_get_global_throttle_in.reset(new network_throttle("in/all","<<< global-IN",10)); } );
- return * m_obj_get_global_throttle_in;
+ static network_throttle obj_get_global_throttle_in("in/all","<<< global-IN",10);
+ return obj_get_global_throttle_in;
}
-boost::once_flag network_throttle_manager::m_once_get_global_throttle_in;
-std::unique_ptr<i_network_throttle> network_throttle_manager::m_obj_get_global_throttle_in;
i_network_throttle & network_throttle_manager::get_global_throttle_inreq() {
- boost::call_once(m_once_get_global_throttle_inreq, [] { m_obj_get_global_throttle_inreq.reset(new network_throttle("inreq/all", "<== global-IN-REQ",10)); } );
- return * m_obj_get_global_throttle_inreq;
+ static network_throttle obj_get_global_throttle_inreq("inreq/all", "<== global-IN-REQ",10);
+ return obj_get_global_throttle_inreq;
}
-boost::once_flag network_throttle_manager::m_once_get_global_throttle_inreq;
-std::unique_ptr<i_network_throttle> network_throttle_manager::m_obj_get_global_throttle_inreq;
i_network_throttle & network_throttle_manager::get_global_throttle_out() {
- boost::call_once(m_once_get_global_throttle_out, [] { m_obj_get_global_throttle_out.reset(new network_throttle("out/all", ">>> global-OUT",10)); } );
- return * m_obj_get_global_throttle_out;
+ static network_throttle obj_get_global_throttle_out("out/all", ">>> global-OUT",10);
+ return obj_get_global_throttle_out;
}
-boost::once_flag network_throttle_manager::m_once_get_global_throttle_out;
-std::unique_ptr<i_network_throttle> network_throttle_manager::m_obj_get_global_throttle_out;