Use unique ptr for bandwidth_limiter

This commit is contained in:
Piotr Wójcik 2024-09-09 22:28:35 +02:00
commit 6a01a97f65
2 changed files with 6 additions and 3 deletions

View file

@ -5,6 +5,7 @@
#include <nano/lib/utility.hpp>
#include <nano/node/active_elections.hpp>
#include <nano/node/backlog_population.hpp>
#include <nano/node/bandwidth_limiter.hpp>
#include <nano/node/bootstrap_ascending/service.hpp>
#include <nano/node/common.hpp>
#include <nano/node/confirming_set.hpp>
@ -146,7 +147,8 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
wallets_store (*wallets_store_impl),
ledger_impl{ std::make_unique<nano::ledger> (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<nano::bandwidth_limiter> (config) },
outbound_limiter{ *outbound_limiter_impl },
message_processor_impl{ std::make_unique<nano::message_processor> (config.message_processor, *this) },
message_processor{ *message_processor_impl },
// empty `config.peering_port` means the user made no port choice at all;

View file

@ -6,7 +6,6 @@
#include <nano/lib/stats.hpp>
#include <nano/lib/thread_pool.hpp>
#include <nano/lib/work.hpp>
#include <nano/node/bandwidth_limiter.hpp>
#include <nano/node/blockprocessor.hpp>
#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/bootstrap_attempt.hpp>
@ -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<nano::ledger> ledger_impl;
nano::ledger & ledger;
nano::bandwidth_limiter outbound_limiter;
std::unique_ptr<nano::bandwidth_limiter> outbound_limiter_impl;
nano::bandwidth_limiter & outbound_limiter;
std::unique_ptr<nano::message_processor> message_processor_impl;
nano::message_processor & message_processor;
nano::network network;