Rename to bandwidth_limiter
This commit is contained in:
parent
87aeef274d
commit
7eb72ccd46
4 changed files with 12 additions and 12 deletions
|
|
@ -2,17 +2,17 @@
|
|||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
|
||||
/*
|
||||
* outbound_bandwidth_limiter
|
||||
* bandwidth_limiter
|
||||
*/
|
||||
|
||||
nano::outbound_bandwidth_limiter::outbound_bandwidth_limiter (nano::outbound_bandwidth_limiter::config config_a) :
|
||||
nano::bandwidth_limiter::bandwidth_limiter (nano::bandwidth_limiter::config config_a) :
|
||||
config_m{ config_a },
|
||||
limiter_standard (config_m.standard_limit, config_m.standard_burst_ratio),
|
||||
limiter_bootstrap{ config_m.bootstrap_limit, config_m.bootstrap_burst_ratio }
|
||||
{
|
||||
}
|
||||
|
||||
nano::rate_limiter & nano::outbound_bandwidth_limiter::select_limiter (nano::bandwidth_limit_type type)
|
||||
nano::rate_limiter & nano::bandwidth_limiter::select_limiter (nano::bandwidth_limit_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -27,13 +27,13 @@ nano::rate_limiter & nano::outbound_bandwidth_limiter::select_limiter (nano::ban
|
|||
return limiter_standard;
|
||||
}
|
||||
|
||||
bool nano::outbound_bandwidth_limiter::should_pass (std::size_t buffer_size, nano::bandwidth_limit_type type)
|
||||
bool nano::bandwidth_limiter::should_pass (std::size_t buffer_size, nano::bandwidth_limit_type type)
|
||||
{
|
||||
auto & limiter = select_limiter (type);
|
||||
return limiter.should_pass (buffer_size);
|
||||
}
|
||||
|
||||
void nano::outbound_bandwidth_limiter::reset (std::size_t limit, double burst_ratio, nano::bandwidth_limit_type type)
|
||||
void nano::bandwidth_limiter::reset (std::size_t limit, double burst_ratio, nano::bandwidth_limit_type type)
|
||||
{
|
||||
auto & limiter = select_limiter (type);
|
||||
limiter.reset (limit, burst_ratio);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ nano::bandwidth_limit_type to_bandwidth_limit_type (nano::transport::traffic_typ
|
|||
/**
|
||||
* Class that tracks and manages bandwidth limits for IO operations
|
||||
*/
|
||||
class outbound_bandwidth_limiter final
|
||||
class bandwidth_limiter final
|
||||
{
|
||||
public: // Config
|
||||
struct config
|
||||
|
|
@ -35,7 +35,7 @@ public: // Config
|
|||
};
|
||||
|
||||
public:
|
||||
explicit outbound_bandwidth_limiter (config);
|
||||
explicit bandwidth_limiter (config);
|
||||
|
||||
/**
|
||||
* Check whether packet falls withing bandwidth limits and should be allowed
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ extern std::size_t nano_bootstrap_weights_beta_size;
|
|||
* configs
|
||||
*/
|
||||
|
||||
nano::outbound_bandwidth_limiter::config nano::outbound_bandwidth_limiter_config (const nano::node_config & config)
|
||||
nano::bandwidth_limiter::config nano::bandwidth_limiter_config (const nano::node_config & config)
|
||||
{
|
||||
outbound_bandwidth_limiter::config cfg{};
|
||||
bandwidth_limiter::config cfg{};
|
||||
cfg.standard_limit = config.bandwidth_limit;
|
||||
cfg.standard_burst_ratio = config.bandwidth_limit_burst_ratio;
|
||||
cfg.bootstrap_limit = config.bootstrap_bandwidth_limit;
|
||||
|
|
@ -159,7 +159,7 @@ 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{ outbound_bandwidth_limiter_config (config) },
|
||||
outbound_limiter{ bandwidth_limiter_config (config) },
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace rocksdb
|
|||
namespace nano
|
||||
{
|
||||
// Configs
|
||||
outbound_bandwidth_limiter::config outbound_bandwidth_limiter_config (node_config const &);
|
||||
bandwidth_limiter::config bandwidth_limiter_config (node_config const &);
|
||||
|
||||
class node final : public std::enable_shared_from_this<node>
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@ public:
|
|||
nano::wallets_store & wallets_store;
|
||||
std::unique_ptr<nano::ledger> ledger_impl;
|
||||
nano::ledger & ledger;
|
||||
nano::outbound_bandwidth_limiter outbound_limiter;
|
||||
nano::bandwidth_limiter outbound_limiter;
|
||||
std::unique_ptr<nano::message_processor> message_processor_impl;
|
||||
nano::message_processor & message_processor;
|
||||
nano::network network;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue