Changed back the first part of gw_MySQLWrite_backend so that it is protected by dcb->authlock which must wait until authentication phase is complete. If authentication fails, the error is handled before next query starts its execution.

This commit is contained in:
VilhoRaatikka
2014-03-18 17:00:43 +02:00
parent 35c460457a
commit d7e9978ac1

View File

@ -297,7 +297,7 @@ static int gw_read_backend_event(DCB *dcb) {
0, 0,
"Connection to backend lost."); "Connection to backend lost.");
// consume all the delay queue // consume all the delay queue
while ((dcb->delayq = gwbuf_consume( while ((dcb->delayq = gwbuf_consume(
dcb->delayq, dcb->delayq,
GWBUF_LENGTH(dcb->delayq))) != NULL); GWBUF_LENGTH(dcb->delayq))) != NULL);
} }
@ -528,7 +528,7 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
/*< /*<
* Don't write to backend if backend_dcb is not in poll set anymore. * Don't write to backend if backend_dcb is not in poll set anymore.
*/ */
spinlock_acquire(&dcb->dcb_initlock); spinlock_acquire(&dcb->authlock);
if (dcb->state != DCB_STATE_POLLING) { if (dcb->state != DCB_STATE_POLLING) {
/*< vraa : errorHandle */ /*< vraa : errorHandle */
/*< Free buffer memory */ /*< Free buffer memory */
@ -543,12 +543,10 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
dcb->fd, dcb->fd,
STRDCBSTATE(dcb->state)))); STRDCBSTATE(dcb->state))));
spinlock_release(&dcb->dcb_initlock); spinlock_release(&dcb->authlock);
return 0; return 0;
} }
spinlock_release(&dcb->dcb_initlock);
spinlock_acquire(&dcb->authlock);
/*< /*<
* Now put the incoming data to the delay queue unless backend is * Now put the incoming data to the delay queue unless backend is
* connected with auth ok * connected with auth ok