Fix a connection bug of mariadb clients (#438)
This commit is contained in:
parent
cddd17eb55
commit
26dca0a910
|
@ -17,6 +17,7 @@
|
|||
#include <algorithm>
|
||||
#include <drogon/utils/Utilities.h>
|
||||
#include <drogon/utils/string_view.h>
|
||||
#include <errmsg.h>
|
||||
#ifndef _WIN32
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
@ -442,9 +443,10 @@ void MysqlConnection::execSqlInLoop(
|
|||
void MysqlConnection::outputError()
|
||||
{
|
||||
channelPtr_->disableAll();
|
||||
LOG_ERROR << "Error(" << mysql_errno(mysqlPtr_.get()) << ") ["
|
||||
<< mysql_sqlstate(mysqlPtr_.get()) << "] \""
|
||||
<< mysql_error(mysqlPtr_.get()) << "\"";
|
||||
auto errorNo = mysql_errno(mysqlPtr_.get());
|
||||
LOG_ERROR << "Error(" << errorNo << ") [" << mysql_sqlstate(mysqlPtr_.get())
|
||||
<< "] \"" << mysql_error(mysqlPtr_.get()) << "\"";
|
||||
|
||||
if (isWorking_)
|
||||
{
|
||||
try
|
||||
|
@ -462,6 +464,10 @@ void MysqlConnection::outputError()
|
|||
isWorking_ = false;
|
||||
idleCb_();
|
||||
}
|
||||
if (errorNo == CR_SERVER_GONE_ERROR)
|
||||
{
|
||||
handleClosed();
|
||||
}
|
||||
}
|
||||
|
||||
void MysqlConnection::getResult(MYSQL_RES *res)
|
||||
|
|
Loading…
Reference in New Issue