Reset master DCB pointer if it is closed

If the master DBC is closed, the pointer should be set to NULL as it is
used to check whether the connection is still valid.
This commit is contained in:
Markus Mäkelä 2017-08-17 14:07:07 +03:00
parent d3a77b64c0
commit 71ca174313
2 changed files with 5 additions and 0 deletions

View File

@ -2404,6 +2404,10 @@ errorReply(MXS_ROUTER *instance,
MXS_FREE(errmsg);
}
*succp = true;
if (backend_dcb == router->master)
{
router->master = NULL;
}
dcb_close(backend_dcb);
MXS_NOTICE("%s: Master %s disconnected after %ld seconds. "
"%lu events read.",

View File

@ -425,6 +425,7 @@ void
blr_master_close(ROUTER_INSTANCE *router)
{
dcb_close(router->master);
router->master = NULL;
router->master_state = BLRM_UNCONNECTED;
router->master_event_state = BLR_EVENT_DONE;
gwbuf_free(router->stored_event);