mysql_client.c:gw_error_client_event & gw_client_hangup_event: added session state check, if session is already closing, don't start redundant call to dcb_close.

mysql_common.c:mysql_protocol_done: added protocol state check. Used not to check it which caused double free of allocated memory.
This commit is contained in:
VilhoRaatikka
2014-08-14 15:15:22 +03:00
parent d3a79ce7c4
commit 77e5525436
5 changed files with 36 additions and 17 deletions

View File

@ -777,11 +777,6 @@ static int gw_error_backend_event(DCB *dcb)
router = session->service->router;
router_instance = session->service->router_instance;
#if defined(SS_DEBUG)
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Backend error event handling.")));
#endif
/**
* Avoid running redundant error handling procedure.
* dcb_close is already called for the DCB. Thus, either connection is
@ -820,6 +815,11 @@ static int gw_error_backend_event(DCB *dcb)
goto retblock;
}
#if defined(SS_DEBUG)
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Backend error event handling.")));
#endif
router->handleError(router_instance,
rsession,
errbuf,
@ -963,14 +963,7 @@ gw_backend_hangup(DCB *dcb)
rsession = session->router_session;
router = session->service->router;
router_instance = session->service->router_instance;
#if defined(SS_DEBUG)
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Backend hangup error handling.")));
#endif
router_instance = session->service->router_instance;
errbuf = mysql_create_custom_error(
1,
@ -999,6 +992,12 @@ gw_backend_hangup(DCB *dcb)
gwbuf_free(errbuf);
goto retblock;
}
#if defined(SS_DEBUG)
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Backend hangup error handling.")));
#endif
router->handleError(router_instance,
rsession,
errbuf,