Fixed debug assertion and protected read of client DCB's state and consistency.

This commit is contained in:
VilhoRaatikka 2014-12-30 10:55:53 +02:00
parent df0b04a5c0
commit b0c152b55c

View File

@ -848,18 +848,21 @@ static void handleError(
else
{
backend_dcb->dcb_errhandle_called = true;
}
}
spinlock_acquire(&session->ses_lock);
sesstate = session->state;
client_dcb = session->client;
spinlock_release(&session->ses_lock);
ss_dassert(client_dcb != NULL);
if (sesstate == SESSION_STATE_ROUTER_READY)
{
CHK_DCB(client_dcb);
spinlock_release(&session->ses_lock);
client_dcb->func.write(client_dcb, gwbuf_clone(errbuf));
}
else
{
spinlock_release(&session->ses_lock);
}
/** false because connection is not available anymore */
*succp = false;