From 6a01a97f651018dfb9d4f5ef0cec92885cd8c2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:28:35 +0200 Subject: [PATCH] Use unique ptr for `bandwidth_limiter` --- nano/node/node.cpp | 4 +++- nano/node/node.hpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nano/node/node.cpp b/nano/node/node.cpp index eb3d42e2e..493506cf3 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -146,7 +147,8 @@ nano::node::node (std::shared_ptr io_ctx_a, std::filesy wallets_store (*wallets_store_impl), ledger_impl{ std::make_unique (store, stats, network_params.ledger, flags_a.generate_cache, config_a.representative_vote_weight_minimum.number ()) }, ledger{ *ledger_impl }, - outbound_limiter{ config }, + outbound_limiter_impl{ std::make_unique (config) }, + outbound_limiter{ *outbound_limiter_impl }, message_processor_impl{ std::make_unique (config.message_processor, *this) }, message_processor{ *message_processor_impl }, // empty `config.peering_port` means the user made no port choice at all; diff --git a/nano/node/node.hpp b/nano/node/node.hpp index 1f44b8031..4cfb7db7d 100644 --- a/nano/node/node.hpp +++ b/nano/node/node.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -41,6 +40,7 @@ namespace nano { class active_elections; class backlog_population; +class bandwidth_limiter; class confirming_set; class message_processor; class monitor; @@ -166,7 +166,8 @@ public: nano::wallets_store & wallets_store; std::unique_ptr ledger_impl; nano::ledger & ledger; - nano::bandwidth_limiter outbound_limiter; + std::unique_ptr outbound_limiter_impl; + nano::bandwidth_limiter & outbound_limiter; std::unique_ptr message_processor_impl; nano::message_processor & message_processor; nano::network network;