From 71ca174313c9a83598bcd01f77eb8992eab99015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 17 Aug 2017 14:07:07 +0300 Subject: [PATCH] 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. --- server/modules/routing/binlogrouter/blr.c | 4 ++++ server/modules/routing/binlogrouter/blr_master.c | 1 + 2 files changed, 5 insertions(+) diff --git a/server/modules/routing/binlogrouter/blr.c b/server/modules/routing/binlogrouter/blr.c index 1e8702d25..843c7d04e 100644 --- a/server/modules/routing/binlogrouter/blr.c +++ b/server/modules/routing/binlogrouter/blr.c @@ -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.", diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index a545efb07..e3405986e 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -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);