Added error check to mysql_backend.c to prevent unnecessary logging.

This commit is contained in:
VilhoRaatikka
2014-12-03 15:42:04 +02:00
parent 730cd67992
commit 6d98df0c37

View File

@ -834,15 +834,19 @@ static int gw_error_backend_event(DCB *dcb)
char buf[100];
len = sizeof(error);
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0)
{
if (error != 0)
{
strerror_r(error, buf, 100);
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"DCB in state %s got error '%s'.",
gw_dcb_state2string(dcb->state),
STRDCBSTATE(dcb->state),
buf)));
}
}
return 1;
}
errbuf = mysql_create_custom_error(
@ -874,6 +878,8 @@ static int gw_error_backend_event(DCB *dcb)
len = sizeof(error);
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0)
{
if (error != 0)
{
strerror_r(error, buf, 100);
LOGIF(LE, (skygw_log_write_flush(
@ -881,6 +887,7 @@ static int gw_error_backend_event(DCB *dcb)
"Error '%s' in session that is not ready for routing.",
buf)));
}
}
gwbuf_free(errbuf);
goto retblock;
}