Fix MySQL connection bug. Cannot use get_target() if not connected.

This commit is contained in:
Xie Han
2023-09-08 20:11:40 +08:00
parent e01a5ca8ae
commit 9b1a191a43

View File

@@ -243,7 +243,7 @@ CommMessageOut *ComplexMySQLTask::message_out()
case ST_FIRST_USER_REQUEST:
if (this->is_fixed_addr())
{
auto *target = (RouteManager::RouteTarget *)this->get_target();
auto *target = (RouteManager::RouteTarget *)this->target;
/* If it's a transaction task, generate a ECONNRESET error when
* the target was reconnected. */
@@ -744,9 +744,8 @@ bool ComplexMySQLTask::finish_once()
{
if (this->state != WFT_STATE_SUCCESS || this->keep_alive_timeo == 0)
{
CommTarget *target = this->get_target();
if (target)
((RouteManager::RouteTarget *)target)->state = 0;
if (this->target)
((RouteManager::RouteTarget *)this->target)->state = 0;
}
}