Move some Monitor fields to private and protected
None of the fields should be publicly writable and some should not even be writable from derived classes.
This commit is contained in:
@ -375,7 +375,7 @@ bool ClustrixMonitor::choose_dynamic_hub(Clustrix::Softfailed softfailed, std::s
|
||||
{
|
||||
ClustrixNode& node = kv.second;
|
||||
|
||||
if (node.can_be_used_as_hub(name(), m_settings.conn_settings, softfailed))
|
||||
if (node.can_be_used_as_hub(name(), settings().conn_settings, softfailed))
|
||||
{
|
||||
m_pHub_con = node.release_connection();
|
||||
m_pHub_server = node.server();
|
||||
@ -398,7 +398,7 @@ bool ClustrixMonitor::choose_bootstrap_hub(Clustrix::Softfailed softfailed, std:
|
||||
{
|
||||
if (ips_checked.find(pMs->server->address) == ips_checked.end())
|
||||
{
|
||||
if (Clustrix::ping_or_connect_to_hub(name(), m_settings.conn_settings, softfailed, *pMs))
|
||||
if (Clustrix::ping_or_connect_to_hub(name(), settings().conn_settings, softfailed, *pMs))
|
||||
{
|
||||
m_pHub_con = pMs->con;
|
||||
m_pHub_server = pMs->server;
|
||||
@ -433,8 +433,8 @@ bool ClustrixMonitor::refresh_using_persisted_nodes(std::set<string>& ips_checke
|
||||
|
||||
if (rv == SQLITE_OK)
|
||||
{
|
||||
const std::string& username = m_settings.conn_settings.username;
|
||||
const std::string& password = m_settings.conn_settings.password;
|
||||
const std::string& username = settings().conn_settings.username;
|
||||
const std::string& password = settings().conn_settings.password;
|
||||
char* zPassword = decrypt_password(password.c_str());
|
||||
|
||||
auto it = nodes.begin();
|
||||
@ -806,7 +806,7 @@ void ClustrixMonitor::check_hub(Clustrix::Softfailed softfailed)
|
||||
mxb_assert(m_pHub_con);
|
||||
mxb_assert(m_pHub_server);
|
||||
|
||||
if (!Clustrix::ping_or_connect_to_hub(name(), m_settings.conn_settings, softfailed,
|
||||
if (!Clustrix::ping_or_connect_to_hub(name(), settings().conn_settings, softfailed,
|
||||
*m_pHub_server, &m_pHub_con))
|
||||
{
|
||||
mysql_close(m_pHub_con);
|
||||
@ -998,7 +998,7 @@ void ClustrixMonitor::initiate_delayed_http_check()
|
||||
{
|
||||
mxb_assert(m_delayed_http_check_id == 0);
|
||||
|
||||
long max_delay_ms = m_settings.interval / 10;
|
||||
long max_delay_ms = settings().interval / 10;
|
||||
|
||||
long ms = m_http.wait_no_more_than();
|
||||
|
||||
|
||||
@ -182,8 +182,8 @@ bool MariaDBMonitor::set_replication_credentials(const MXS_CONFIG_PARAMETER* par
|
||||
else
|
||||
{
|
||||
// Ok, neither is set. Use monitor credentials.
|
||||
repl_user = m_settings.conn_settings.username;
|
||||
repl_pw = m_settings.conn_settings.password;
|
||||
repl_user = settings().conn_settings.username;
|
||||
repl_pw = settings().conn_settings.password;
|
||||
}
|
||||
}
|
||||
|
||||
@ -395,7 +395,7 @@ void MariaDBMonitor::tick()
|
||||
|
||||
// Query all servers for their status.
|
||||
bool should_update_disk_space = check_disk_space_this_tick();
|
||||
const auto& conn_settings = m_settings.conn_settings;
|
||||
const auto& conn_settings = settings().conn_settings;
|
||||
|
||||
auto update_task = [should_update_disk_space, conn_settings](MariaDBServer* server) {
|
||||
server->update_server(should_update_disk_space, conn_settings);
|
||||
|
||||
@ -159,7 +159,7 @@ void MariaDBMonitor::Test::init_servers(int count)
|
||||
{
|
||||
// Server contents mostly undefined
|
||||
auto base_server = Server::create_test_server();
|
||||
MonitorServer* mon_server = new MonitorServer(base_server, m_monitor->m_settings.disk_space_limits);
|
||||
MonitorServer* mon_server = new MonitorServer(base_server, m_monitor->settings().disk_space_limits);
|
||||
MariaDBServer* mariadb_server = new MariaDBServer(mon_server, i - 1, m_use_hostnames, true);
|
||||
|
||||
if (m_use_hostnames)
|
||||
|
||||
Reference in New Issue
Block a user