From 994d4ddfed69ec64aaa88509380b8f6a44fc6fdd Mon Sep 17 00:00:00 2001 From: XieHan Date: Thu, 16 Sep 2021 20:38:18 +0800 Subject: [PATCH] [MySQL] reset target's state when disconnected by user --- src/factory/MySQLTaskImpl.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/factory/MySQLTaskImpl.cc b/src/factory/MySQLTaskImpl.cc index 4b3f86e1..678aa627 100644 --- a/src/factory/MySQLTaskImpl.cc +++ b/src/factory/MySQLTaskImpl.cc @@ -603,11 +603,14 @@ bool ComplexMySQLTask::finish_once() return false; } - if (this->is_fixed_addr() && this->state != WFT_STATE_SUCCESS) + if (this->is_fixed_addr()) { - auto *target = (RouteManager::RouteTarget *)this->get_target(); - if (target) - target->state = 0; + if (this->state != WFT_STATE_SUCCESS || this->keep_alive_timeo == 0) + { + auto *target = (RouteManager::RouteTarget *)this->get_target(); + if (target) + target->state = 0; + } } return true;