Remove redundant states
The closed state is not required as a separate boolean is used to track it.
This commit is contained in:
@ -238,8 +238,7 @@ private:
|
|||||||
{
|
{
|
||||||
IN_USE = 0x01, /**< Backend has been taken into use */
|
IN_USE = 0x01, /**< Backend has been taken into use */
|
||||||
WAITING_RESULT = 0x02, /**< Waiting for a reply */
|
WAITING_RESULT = 0x02, /**< Waiting for a reply */
|
||||||
CLOSED = 0x04, /**< Backend is no longer in use */
|
FATAL_FAILURE = 0x04 /**< Backend references that should be dropped */
|
||||||
FATAL_FAILURE = 0x08 /**< Backend references that should be dropped */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,6 @@ void Backend::close(close_type type)
|
|||||||
clear_state(WAITING_RESULT);
|
clear_state(WAITING_RESULT);
|
||||||
}
|
}
|
||||||
clear_state(IN_USE);
|
clear_state(IN_USE);
|
||||||
set_state(CLOSED);
|
|
||||||
|
|
||||||
if (type == CLOSE_FATAL)
|
if (type == CLOSE_FATAL)
|
||||||
{
|
{
|
||||||
@ -189,6 +188,7 @@ bool Backend::connect(MXS_SESSION* session)
|
|||||||
|
|
||||||
if ((m_dcb = dcb_connect(m_backend->server, session, m_backend->server->protocol)))
|
if ((m_dcb = dcb_connect(m_backend->server, session, m_backend->server->protocol)))
|
||||||
{
|
{
|
||||||
|
m_closed = false;
|
||||||
m_state = IN_USE;
|
m_state = IN_USE;
|
||||||
atomic_add(&m_backend->connections, 1);
|
atomic_add(&m_backend->connections, 1);
|
||||||
rval = true;
|
rval = true;
|
||||||
@ -276,7 +276,7 @@ bool Backend::is_waiting_result() const
|
|||||||
|
|
||||||
bool Backend::is_closed() const
|
bool Backend::is_closed() const
|
||||||
{
|
{
|
||||||
return m_state & CLOSED;
|
return m_closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Backend::has_failed() const
|
bool Backend::has_failed() const
|
||||||
|
Reference in New Issue
Block a user