MXS-2220 Move server_is_active inside the class

This commit is contained in:
Esa Korhonen
2019-01-04 15:27:03 +02:00
parent 764d9a4e75
commit b16ee3a94e
10 changed files with 29 additions and 28 deletions

View File

@ -236,7 +236,7 @@ public:
*/
inline bool is_active() const
{
return SERVER_REF_IS_ACTIVE(m_backend);
return server_ref_is_active(m_backend);
}
/**

View File

@ -212,6 +212,16 @@ public:
*/
void update_extra_port(int new_port);
/**
* Is the server valid and active? TODO: Rename once "is_active" is moved to internal class.
*
* @return True, if server has not been removed from the runtime configuration.
*/
bool server_is_active() const
{
return is_active;
}
protected:
SERVER()
{
@ -241,17 +251,6 @@ private:
// Bits providing general information
#define SERVER_DISK_SPACE_EXHAUSTED (1 << 31) /**<< The disk space of the server is exhausted */
/**
* Is the server valid and active?
*
* @param server The server
* @return True, if server has not been removed from the runtime configuration.
*/
inline bool server_is_active(const SERVER* server)
{
return server->is_active;
}
inline bool status_is_usable(uint64_t status)
{
return (status & (SERVER_RUNNING | SERVER_MAINT)) == SERVER_RUNNING;

View File

@ -59,8 +59,10 @@ typedef struct server_ref_t
bool active; /**< Whether this reference is valid and in use*/
} SERVER_REF;
/** Macro to check whether a SERVER_REF is active */
#define SERVER_REF_IS_ACTIVE(ref) (ref->active && server_is_active(ref->server))
inline bool server_ref_is_active(const SERVER_REF* ref)
{
return ref->active && ref->server->server_is_active();
}
#define SERVICE_MAX_RETRY_INTERVAL 3600 /*< The maximum interval between service start retries */