From c48b2477e33a64dcfc0bf92ac069819a38c542b5 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Thu, 27 Jun 2013 12:36:11 +0200 Subject: [PATCH] Add missing hangup entry point --- modules/protocol/mysql_client.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/protocol/mysql_client.c b/modules/protocol/mysql_client.c index 505d32930..dfdbae458 100644 --- a/modules/protocol/mysql_client.c +++ b/modules/protocol/mysql_client.c @@ -40,6 +40,7 @@ static int gw_write_client_event(DCB *dcb); static int gw_MySQLWrite_client(DCB *dcb, GWBUF *queue); static int gw_error_client_event(DCB *dcb); static int gw_client_close(DCB *dcb); +static int gw_client_hangup_event(DCB *dcb); static int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_len, uint8_t *scramble, unsigned int scramble_len, char *username, uint8_t *stage1_hash); static int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password, void *repository); @@ -56,7 +57,7 @@ static GWPROTOCOL MyObject = { gw_MySQLWrite_client, /* Write - data from gateway */ gw_write_client_event, /* WriteReady - EPOLLOUT handler */ gw_error_client_event, /* Error - EPOLLERR handler */ - NULL, /* HangUp - EPOLLHUP handler */ + gw_client_hangup_event, /* HangUp - EPOLLHUP handler */ gw_MySQLAccept, /* Accept */ NULL, /* Connect */ gw_client_close, /* Close */ @@ -1159,3 +1160,18 @@ gw_client_close(DCB *dcb) dcb_close(dcb); return 1; } + +/** + * Handle a hangup event on the client side descriptor. + * + * We simply close the DCB, this will propogate the closure to any + * backend descriptors and perform the session cleanup. + * + * @param dcb The DCB of the connection + */ +static int +gw_client_hangup_event(DCB *dcb) +{ + dcb_close(dcb); + return 1; +}