In gw_read_client_event, if ioctl returns non-zero and 'b' (number of readable bytes) is zero, that indicates that socket is closed. Thus, read is now skipped and dcb closed if it is in DSC_STATE_POLLING state.
This commit is contained in:
@ -536,10 +536,27 @@ int gw_read_client_event(DCB* dcb) {
|
|||||||
dcb->state);
|
dcb->state);
|
||||||
rc = 1;
|
rc = 1;
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
} else {
|
|
||||||
//fprintf(stderr, "Client IOCTL FIONREAD bytes to read = %i\n", b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Socket was closed.
|
||||||
|
*/
|
||||||
|
if (b == 0) {
|
||||||
|
skygw_log_write(
|
||||||
|
LOGFILE_TRACE,
|
||||||
|
"%lu [gw_read_client_event] Dcb %p fd %d was closed. "
|
||||||
|
"Closing dcb.",
|
||||||
|
pthread_self(),
|
||||||
|
dcb,
|
||||||
|
dcb->fd);
|
||||||
|
|
||||||
|
if (dcb->state == DCB_STATE_POLLING) {
|
||||||
|
dcb->func.close(dcb);
|
||||||
|
}
|
||||||
|
rc = 0;
|
||||||
|
goto return_rc;
|
||||||
|
}
|
||||||
|
|
||||||
switch (protocol->state) {
|
switch (protocol->state) {
|
||||||
case MYSQL_AUTH_SENT:
|
case MYSQL_AUTH_SENT:
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user