Skip to content

Commit

Permalink
Fix integer overflow on connection_max_age_ms #1393
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Mar 6, 2018
1 parent b347178 commit be0843c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/MySQL_HostGroups_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,9 @@ void MySQL_HostGroups_Manager::drop_all_idle_connections() {
int i=0;
for (i=0; i<(int)mscl->conns_length() ; i++) {
MySQL_Connection *mc=mscl->index(i);
if (curtime > mc->creation_time + mysql_thread___connection_max_age_ms * 1000) {
unsigned long long intv = mysql_thread___connection_max_age_ms;
intv *= 1000;
if (curtime > mc->creation_time + intv) {
mc=mscl->remove(0);
delete mc;
i--;
Expand Down
4 changes: 3 additions & 1 deletion lib/mysql_data_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,9 @@ void MySQL_Data_Stream::setDSS_STATE_QUERY_SENT_NET() {
void MySQL_Data_Stream::return_MySQL_Connection_To_Pool() {
MySQL_Connection *mc=myconn;
mc->last_time_used=sess->thread->curtime;
if ((mysql_thread___connection_max_age_ms) && (mc->last_time_used > mc->creation_time + mysql_thread___connection_max_age_ms * 1000)) {
unsigned long long intv = mysql_thread___connection_max_age_ms;
intv *= 1000;
if ((intv) && (mc->last_time_used > mc->creation_time + intv)) {
destroy_MySQL_Connection_From_Pool(true);
} else {
detach_connection();
Expand Down

0 comments on commit be0843c

Please sign in to comment.