Referencing network_constants by reference within websocket_config.

This commit is contained in:
clemahieu 2021-08-08 10:25:21 +01:00
commit 68f07fa276
No known key found for this signature in database
GPG key ID: 43708520C8DFB938
3 changed files with 7 additions and 5 deletions

View file

@ -29,6 +29,7 @@ nano::node_config::node_config (uint16_t peering_port_a, nano::logging const & l
network_params{ network_params },
peering_port{ peering_port_a },
logging{ logging_a },
websocket_config{ network_params.network },
external_address{ boost::asio::ip::address_v6{}.to_string () }
{
// The default constructor passes 0 to indicate we should use the default port,

View file

@ -3,9 +3,10 @@
#include <nano/lib/tomlconfig.hpp>
#include <nano/node/websocketconfig.hpp>
nano::websocket::config::config () :
port (network_constants.default_websocket_port),
address (boost::asio::ip::address_v6::loopback ().to_string ())
nano::websocket::config::config (nano::network_constants & network_constants) :
network_constants{ network_constants },
port{ network_constants.default_websocket_port },
address{ boost::asio::ip::address_v6::loopback ().to_string () }
{
}

View file

@ -13,12 +13,12 @@ namespace websocket
class config final
{
public:
config ();
config (nano::network_constants & network_constants);
nano::error deserialize_json (nano::jsonconfig & json_a);
nano::error serialize_json (nano::jsonconfig & json) const;
nano::error deserialize_toml (nano::tomlconfig & toml_a);
nano::error serialize_toml (nano::tomlconfig & toml) const;
nano::network_constants network_constants;
nano::network_constants & network_constants;
bool enabled{ false };
uint16_t port;
std::string address;