diff options
Diffstat (limited to 'sql/threadpool_generic.cc')
-rw-r--r-- | sql/threadpool_generic.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index f128661ec60..6d6b22d5900 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Monty Program Ab +/* Copyright (C) 2012, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -583,11 +583,21 @@ static my_bool timeout_check(THD *thd, pool_timer_t *timer) DBUG_ENTER("timeout_check"); if (thd->net.reading_or_writing == 1) { - /* - Check if connection does not have scheduler data. This happens for example - if THD belongs to a different scheduler, that is listening to extra_port. - */ - if (auto connection= (TP_connection_generic *) thd->event_scheduler.data) + TP_connection_generic *connection= (TP_connection_generic *)thd->event_scheduler.data; + if (!connection || connection->state != TP_STATE_IDLE) + { + /* + Connection does not have scheduler data. This happens for example + if THD belongs to a different scheduler, that is listening to extra_port. + */ + DBUG_RETURN(0); + } + + if(connection->abs_wait_timeout < timer->current_microtime) + { + tp_timeout_handler(connection); + } + else { if (connection->abs_wait_timeout < timer->current_microtime) tp_timeout_handler(connection); |