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:
vraatikka 2013-09-27 14:57:53 +03:00
parent 1120ae9b2c
commit e03d2b3ffe

View File

@ -536,9 +536,26 @@ int gw_read_client_event(DCB* dcb) {
dcb->state);
rc = 1;
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) {
case MYSQL_AUTH_SENT: