dcb->state set wheere missing or changed
This commit is contained in:
@ -120,6 +120,8 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
MySQLProtocol *backend_protocol = NULL;
|
MySQLProtocol *backend_protocol = NULL;
|
||||||
MYSQL_session *current_session = NULL;
|
MYSQL_session *current_session = NULL;
|
||||||
|
|
||||||
|
dcb->state = DCB_STATE_PROCESSING;
|
||||||
|
|
||||||
if(dcb->session) {
|
if(dcb->session) {
|
||||||
client_protocol = SESSION_PROTOCOL(dcb->session, MySQLProtocol);
|
client_protocol = SESSION_PROTOCOL(dcb->session, MySQLProtocol);
|
||||||
}
|
}
|
||||||
@ -143,6 +145,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
current_session->client_sha1,
|
current_session->client_sha1,
|
||||||
backend_protocol);
|
backend_protocol);
|
||||||
|
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +209,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
"backend session.",
|
"backend session.",
|
||||||
pthread_self());
|
pthread_self());
|
||||||
}
|
}
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case MYSQL_SUCCESFUL_AUTHENTICATION:
|
case MYSQL_SUCCESFUL_AUTHENTICATION:
|
||||||
@ -225,15 +229,18 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
/* check the delay queue and flush the data */
|
/* check the delay queue and flush the data */
|
||||||
if(dcb->delayq) {
|
if(dcb->delayq) {
|
||||||
backend_write_delayqueue(dcb);
|
backend_write_delayqueue(dcb);
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
spinlock_release(&dcb->authlock);
|
spinlock_release(&dcb->authlock);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
spinlock_release(&dcb->authlock);
|
spinlock_release(&dcb->authlock);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* no other authentication state here right now, so just return */
|
/* no other authentication state here right now, so just return */
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,10 +278,12 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
|
|
||||||
/* and pass now the gwbuf to the router */
|
/* and pass now the gwbuf to the router */
|
||||||
router->clientReply(router_instance, rsession, head, dcb);
|
router->clientReply(router_instance, rsession, head, dcb);
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,22 +295,27 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
*/
|
*/
|
||||||
static int gw_write_backend_event(DCB *dcb) {
|
static int gw_write_backend_event(DCB *dcb) {
|
||||||
MySQLProtocol *backend_protocol = dcb->protocol;
|
MySQLProtocol *backend_protocol = dcb->protocol;
|
||||||
|
int w = 0;
|
||||||
|
|
||||||
//fprintf(stderr, ">>> backend EPOLLOUT %i, protocol state [%s]\n", backend_protocol->fd, gw_mysql_protocol_state2string(backend_protocol->state));
|
//fprintf(stderr, ">>> backend EPOLLOUT %i, protocol state [%s]\n", backend_protocol->fd, gw_mysql_protocol_state2string(backend_protocol->state));
|
||||||
|
|
||||||
// spinlock_acquire(&dcb->connectlock);
|
// spinlock_acquire(&dcb->connectlock);
|
||||||
|
dcb->state = DCB_STATE_PROCESSING;
|
||||||
|
|
||||||
if (backend_protocol->state == MYSQL_PENDING_CONNECT) {
|
if (backend_protocol->state == MYSQL_PENDING_CONNECT) {
|
||||||
backend_protocol->state = MYSQL_CONNECTED;
|
backend_protocol->state = MYSQL_CONNECTED;
|
||||||
|
|
||||||
// spinlock_release(&dcb->connectlock);
|
// spinlock_release(&dcb->connectlock);
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// spinlock_release(&dcb->connectlock);
|
// spinlock_release(&dcb->connectlock);
|
||||||
|
|
||||||
return dcb_drain_writeq(dcb);
|
w = dcb_drain_writeq(dcb);
|
||||||
|
dcb->state = DCB_STATE_POLLING;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -118,8 +118,6 @@ int gw_read_backend_handshake(MySQLProtocol *conn) {
|
|||||||
uint8_t *payload = NULL;
|
uint8_t *payload = NULL;
|
||||||
|
|
||||||
if ((n = dcb_read(dcb, &head)) != -1) {
|
if ((n = dcb_read(dcb, &head)) != -1) {
|
||||||
dcb->state = DCB_STATE_PROCESSING;
|
|
||||||
|
|
||||||
if (head) {
|
if (head) {
|
||||||
payload = GWBUF_DATA(head);
|
payload = GWBUF_DATA(head);
|
||||||
|
|
||||||
@ -134,8 +132,6 @@ int gw_read_backend_handshake(MySQLProtocol *conn) {
|
|||||||
// consume all the data here
|
// consume all the data here
|
||||||
head = gwbuf_consume(head, gwbuf_length(head));
|
head = gwbuf_consume(head, gwbuf_length(head));
|
||||||
|
|
||||||
dcb->state = DCB_STATE_POLLING;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +226,6 @@ int gw_receive_backend_auth(MySQLProtocol *conn) {
|
|||||||
uint8_t *ptr = NULL;
|
uint8_t *ptr = NULL;
|
||||||
|
|
||||||
if ((n = dcb_read(dcb, &head)) != -1) {
|
if ((n = dcb_read(dcb, &head)) != -1) {
|
||||||
dcb->state = DCB_STATE_PROCESSING;
|
|
||||||
if (head) {
|
if (head) {
|
||||||
ptr = GWBUF_DATA(head);
|
ptr = GWBUF_DATA(head);
|
||||||
// check if the auth is SUCCESFUL
|
// check if the auth is SUCCESFUL
|
||||||
@ -246,8 +241,6 @@ int gw_receive_backend_auth(MySQLProtocol *conn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dcb->state = DCB_STATE_POLLING;
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user