Rename server_is_running() to server_is_usable()

The previous name was misleading. The new server_is_running() only
checks for the running bit so that a server is always either running
or down.
This commit is contained in:
Esa Korhonen
2018-07-27 13:20:47 +03:00
parent 89dfc80f86
commit 1e33ab69f2
11 changed files with 51 additions and 23 deletions

View File

@ -147,7 +147,7 @@ public:
*/
inline bool can_connect() const
{
return !has_failed() && server_is_running(m_backend->server);
return !has_failed() && server_is_usable(m_backend->server);
}
/**

View File

@ -202,9 +202,9 @@ typedef enum skygw_chk_t
(server_is_slave(s) ? "RUNNING SLAVE" : \
(server_is_joined(s) ? "RUNNING JOINED" : \
(server_is_ndb(s) ? "RUNNING NDB" : \
((!server_is_down(s) && server_is_in_maint(s)) ? "RUNNING MAINTENANCE" : \
((server_is_running(s) && server_is_in_maint(s)) ? "RUNNING MAINTENANCE" : \
(server_is_relay(s) ? "RUNNING RELAY" : \
(server_is_running(s) ? "RUNNING (only)" : \
(server_is_usable(s) ? "RUNNING (only)" : \
(server_is_down(s) ? "DOWN" : "UNKNOWN STATUS"))))))))
#define STRTARGET(t) (t == TARGET_ALL ? "TARGET_ALL" : \

View File

@ -205,16 +205,32 @@ inline bool server_is_active(const SERVER* server)
return server->is_active;
}
inline bool status_is_running(uint64_t status)
inline bool status_is_usable(uint64_t status)
{
return (status & (SERVER_RUNNING | SERVER_MAINT)) == SERVER_RUNNING;
}
/**
* Is the server running and not in maintenance?
*
* @param server The server
* @return True, if server can be used.
*/
inline bool server_is_usable(const SERVER* server)
{
return status_is_usable(server->status);
}
inline bool status_is_running(uint64_t status)
{
return (status & SERVER_RUNNING);
}
/**
* Is the server running?
*
* @param server The server
* @return True, if monitor can connect to server.
* @return True, if monitor can connect to the server.
*/
inline bool server_is_running(const SERVER* server)
{