if (ret == SQL_DOWN) {
/* close the socket that failed */
- (inst->module->sql_close)(sqlsocket, inst->config);
+ if (sqlsocket->state == sockconnected) {
+ (inst->module->sql_close)(sqlsocket, inst->config);
+ }
/* reconnect the socket */
if (connect_single_socket(sqlsocket, inst) < 0) {
if (ret == SQL_DOWN) {
/* close the socket that failed */
- (inst->module->sql_close)(sqlsocket, inst->config);
+ if (sqlsocket->state == sockconnected) {
+ (inst->module->sql_close)(sqlsocket, inst->config);
+ }
/* reconnect the socket */
if (connect_single_socket(sqlsocket, inst) < 0) {