Close client DCB with a hangup in the backend protocol

Directly closing the client DCB in the backend protocol modules is not
correct anymore as the state of the session doesn't change when the client
DCB is closed. By propagating the shutdown of the session with a fake
hangup to the client DCB, the closing of the DCB is done only once.

Added debug assertions that make sure all DCBs are closed only
once. Removed redundant code in the backend protocol error handling code.
This commit is contained in:
Markus Mäkelä
2018-02-01 00:39:45 +02:00
parent a83b36ca45
commit ebf0d6fc5f
2 changed files with 5 additions and 8 deletions

View File

@ -599,13 +599,8 @@ static void gw_reply_on_error(DCB *dcb, mxs_auth_state_t state)
MXS_SESSION *session = dcb->session;
CHK_SESSION(session);
if (!dcb->dcb_errhandle_called)
{
do_handle_error(dcb, ERRACT_REPLY_CLIENT,
"Authentication with backend failed. Session will be closed.");
session->state = SESSION_STATE_STOPPING;
dcb->dcb_errhandle_called = true;
}
do_handle_error(dcb, ERRACT_REPLY_CLIENT,
"Authentication with backend failed. Session will be closed.");
}
/**
@ -1348,7 +1343,7 @@ static int gw_backend_close(DCB *dcb)
session->state == SESSION_STATE_STOPPING &&
session->client_dcb->state == DCB_STATE_POLLING)
{
dcb_close(session->client_dcb);
poll_fake_hangup_event(session->client_dcb);
}
return 1;