MXS-2196: Rename session states

Minor renaming of the session state enum values. Also exposed the session
state stringification function in the public header and removed the
stringification macro.
This commit is contained in:
Markus Mäkelä
2018-12-05 14:34:45 +02:00
parent 7aaadfc550
commit 20fe9b9dca
15 changed files with 39 additions and 92 deletions

View File

@ -773,7 +773,7 @@ static int gw_read_do_authentication(DCB* dcb, GWBUF* read_buffer, int nbytes_re
*/
if (session_start(dcb->session))
{
mxb_assert(dcb->session->state != SESSION_STATE_ALLOC);
mxb_assert(dcb->session->state != SESSION_STATE_CREATED);
// For the time being only the sql_mode is stored in MXS_SESSION::client_protocol_data.
dcb->session->client_protocol_data = QC_SQL_MODE_DEFAULT;
protocol->protocol_auth_state = MXS_AUTH_STATE_COMPLETE;
@ -1048,12 +1048,12 @@ static int gw_read_normal_data(DCB* dcb, GWBUF* read_buffer, int nbytes_read)
session = dcb->session;
session_state_value = session->state;
if (session_state_value != SESSION_STATE_ROUTER_READY)
if (session_state_value != SESSION_STATE_STARTED)
{
if (session_state_value != SESSION_STATE_STOPPING)
{
MXS_ERROR("Session received a query in incorrect state %s",
STRSESSIONSTATE(session_state_value));
MXS_ERROR("Session received a query in incorrect state: %s",
session_state_to_string(session_state_value));
}
gwbuf_free(read_buffer);
dcb_close(dcb);
@ -1462,7 +1462,7 @@ static int gw_client_close(DCB* dcb)
{
MXS_SESSION* target = dcb->session;
if (target->state == SESSION_STATE_ROUTER_READY || target->state == SESSION_STATE_STOPPING)
if (target->state == SESSION_STATE_STARTED || target->state == SESSION_STATE_STOPPING)
{
MXB_AT_DEBUG(bool removed = ) mxs_rworker_deregister_session(target->ses_id);
mxb_assert(removed);