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

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