Merge pull request #88 from wangbin579/master

Add read timeout processing for admin
This commit is contained in:
wangbin 2018-06-01 17:09:27 +08:00 committed by GitHub
commit e8b9e7fdd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2506,6 +2506,19 @@ NETWORK_MYSQLD_PLUGIN_PROTO(server_read_query)
return NETWORK_SOCKET_SUCCESS;
}
NETWORK_MYSQLD_PLUGIN_PROTO(proxy_timeout)
{
int diff = con->srv->current_time - con->client->update_time;
if (diff >= con->srv->client_idle_timeout) {
con->prev_state = con->state;
con->state = ST_SEND_ERROR;
}
return NETWORK_SOCKET_SUCCESS;
}
/**
* cleanup the admin specific data on the current connection
*
@ -2528,6 +2541,8 @@ network_mysqld_server_connection_init(network_mysqld_con *con)
con->plugins.con_read_query = server_read_query;
con->plugins.con_timeout = proxy_timeout;
con->plugins.con_cleanup = admin_disconnect_client;
return 0;