From c8a9eafdc0c7a3b5ed544806529d6169c41f028b Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Wed, 9 Dec 2015 17:00:28 +0200 Subject: [PATCH] Replaced explicit closeSession calls with dcb_close The closeSession entry point shouldn't be called directly and dcb_close should be used instead. --- server/modules/routing/binlog/blr.c | 8 -------- server/modules/routing/binlog/blr_slave.c | 16 +++------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/server/modules/routing/binlog/blr.c b/server/modules/routing/binlog/blr.c index 930379c12..8af4fc39a 100644 --- a/server/modules/routing/binlog/blr.c +++ b/server/modules/routing/binlog/blr.c @@ -897,14 +897,6 @@ ROUTER_SLAVE *slave = (ROUTER_SLAVE *)router_session; /* Unlock */ rses_end_locked_router_action(slave); - - /** - * Close the slave server connection - */ - if (slave->dcb != NULL) { - CHK_DCB(slave->dcb); - dcb_close(slave->dcb); - } } } diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index 315c2377e..59137a7b0 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -2061,14 +2061,6 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; if (hdr.ok == SLAVE_POS_READ_UNSAFE) { - ROUTER_OBJECT *router_obj; - - spinlock_acquire(&router->lock); - - router_obj = router->service->router; - - spinlock_release(&router->lock); - MXS_ERROR("%s: Slave %s:%i, server-id %d, binlog '%s', %s", router->service->name, slave->dcb->remote, @@ -2081,7 +2073,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; * Close the slave session and socket * The slave will try to reconnect */ - router_obj->closeSession(router->service->router_instance, slave); + dcb_close(slave->dcb); return 0; } @@ -2678,8 +2670,7 @@ blr_slave_disconnect_server(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, int se /* send server_id with disconnect state to client */ n = blr_slave_send_disconnected_server(router, slave, server_id, 1); - /* force session close for matched slave */ - router_obj->closeSession(router->service->router_instance, sptr); + dcb_close(sptr->dcb); break; } else { @@ -2777,8 +2768,7 @@ blr_slave_disconnect_all(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave) slave->dcb->func.write(slave->dcb, pkt); - /* force session close*/ - router_obj->closeSession(router->service->router_instance, sptr); + dcb_close(sptr->dcb); } sptr = sptr->next;