From 37bd63b33bb602cdf44d1347b09370d66d1f2699 Mon Sep 17 00:00:00 2001 From: Massimiliano Pinto Date: Wed, 2 Oct 2013 11:15:04 +0200 Subject: [PATCH] Detected closed socket in mysql_client.c:gw_read_client_event now calls the closeSession. This will fix left opened backend connections if the client connection aborts --- server/modules/protocol/mysql_client.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/modules/protocol/mysql_client.c b/server/modules/protocol/mysql_client.c index 04edd78bd..1b47d17c0 100644 --- a/server/modules/protocol/mysql_client.c +++ b/server/modules/protocol/mysql_client.c @@ -539,7 +539,7 @@ int gw_read_client_event(DCB* dcb) { } /** - * Socket was closed. + * The client socket was closed. */ if (b == 0) { skygw_log_write( @@ -554,6 +554,17 @@ int gw_read_client_event(DCB* dcb) { dcb->func.close(dcb); } rc = 0; + + // get the backend session, if available, and close the session + if (session != NULL) { + CHK_SESSION(session); + router = session->service->router; + router_instance = session->service->router_instance; + rsession = session->router_session; + if (rsession) + router->closeSession(router_instance, rsession); + } + goto return_rc; }