Move sending of the OK on client side authentication to the EPOLLIN event processing routine

Addition of a compile switch to make epoll block rather than timeout, useful only for debugging
This commit is contained in:
Mark Riddoch
2013-06-27 09:28:34 +02:00
parent 3b8ebfd215
commit 99465dd6b7
2 changed files with 31 additions and 25 deletions

View File

@ -823,11 +823,33 @@ int gw_read_client_event(DCB* dcb) {
queue = gwbuf_consume(queue, len);
if (auth_val == 0)
{
SESSION *session = NULL;
protocol->state = MYSQL_AUTH_RECV;
//write to client mysql AUTH_OK packet, packet n. is 2
mysql_send_ok(dcb, 2, 0, NULL);
// start a new session, and connect to backends
session = session_alloc(dcb->service, dcb);
protocol->state = MYSQL_IDLE;
session->data = (MYSQL_session *)dcb->data;
}
else
{
protocol->state = MYSQL_AUTH_FAILED;
// still to implement
mysql_send_auth_error(dcb, 2, 0, "Authorization failed");
dcb->func.close(dcb);
}
}
break;
case MYSQL_IDLE:
@ -952,31 +974,6 @@ int gw_write_client_event(DCB *dcb) {
return 1;
}
if(protocol->state == MYSQL_AUTH_RECV) {
SESSION *session = NULL;
//write to client mysql AUTH_OK packet, packet n. is 2
mysql_send_ok(dcb, 2, 0, NULL);
// start a new session, and connect to backends
session = session_alloc(dcb->service, dcb);
protocol->state = MYSQL_IDLE;
session->data = (MYSQL_session *)dcb->data;
return 0;
}
if (protocol->state == MYSQL_AUTH_FAILED) {
// still to implement
mysql_send_auth_error(dcb, 2, 0, "Authorization failed");
dcb->func.close(dcb);
return 0;
}
if ((protocol->state == MYSQL_IDLE) || (protocol->state == MYSQL_WAITING_RESULT)) {
int w;