Skip to content

Commit

Permalink
Do not try to gracefully close a not fully established connection
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed May 8, 2019
1 parent 921f159 commit e5226f9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/mysql_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,20 @@ MySQL_Connection::~MySQL_Connection() {
}
if (mysql) {
// always decrease the counter
if (ret_mysql)
if (ret_mysql) {
__sync_fetch_and_sub(&MyHGM->status.server_connections_connected,1);
if (query.stmt_result) {
if (query.stmt_result->handle) {
query.stmt_result->handle->status = MYSQL_STATUS_READY; // avoid calling mthd_my_skip_result()
if (query.stmt_result) {
if (query.stmt_result->handle) {
query.stmt_result->handle->status = MYSQL_STATUS_READY; // avoid calling mthd_my_skip_result()
}
}
}
if (mysql_result) {
if (mysql_result->handle) {
mysql_result->handle->status = MYSQL_STATUS_READY; // avoid calling mthd_my_skip_result()
if (mysql_result) {
if (mysql_result->handle) {
mysql_result->handle->status = MYSQL_STATUS_READY; // avoid calling mthd_my_skip_result()
}
}
async_free_result();
}
async_free_result();
close_mysql(); // this take care of closing mysql connection
mysql=NULL;
}
Expand Down Expand Up @@ -1680,7 +1681,7 @@ void MySQL_Connection::optimize() {
// if avoids that a QUIT command stops forever
// FIXME: currently doesn't support encryption and compression
void MySQL_Connection::close_mysql() {
if ((send_quit) && (mysql->net.vio)) {
if ((send_quit) && (mysql->net.vio) && ret_mysql) {
char buff[5];
mysql_hdr myhdr;
myhdr.pkt_id=0;
Expand Down

0 comments on commit e5226f9

Please sign in to comment.