MXS-1503: Don't use empty smart pointers

The check for the existence of a valid pointer is now done in the correct
place.
This commit is contained in:
Markus Mäkelä
2018-03-28 09:16:48 +03:00
parent be2186c8f1
commit 3f803ab3e8

View File

@ -460,22 +460,29 @@ SRWBackend get_target_backend(RWSplitSession *rses, backend_type_t btype,
/** get root master from available servers */ /** get root master from available servers */
SRWBackend master = get_root_master(rses->backends); SRWBackend master = get_root_master(rses->backends);
if (master && master->in_use()) if (master)
{ {
if (master->is_master()) if (master->in_use())
{ {
rval = master; if (master->is_master())
{
rval = master;
}
else
{
MXS_ERROR("Server '%s' does not have the master state and "
"can't be chosen as the master.", master->name());
}
} }
else else
{ {
MXS_ERROR("Server '%s' does not have the master state and " MXS_ERROR("Server '%s' is not in use and can't be chosen as the master.",
"can't be chosen as the master.", master->name()); master->name());
} }
} }
else else
{ {
MXS_ERROR("Server '%s' is not in use and can't be chosen as the master.", MXS_ERROR("No master server available at this time.");
master->name());
} }
} }