#include <freeradius-devel/ident.h>
RCSID("$Id$")
-#include <freeradius-devel/autoconf.h>
+#include <freeradius-devel/radiusd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
#include <sys/file.h>
-#include <string.h>
#include <sys/stat.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <netdb.h>
#include <pwd.h>
-#include <time.h>
#include <ctype.h>
-#include <unistd.h>
#include <signal.h>
-#include <errno.h>
#include <sys/wait.h>
-#include <freeradius-devel/radiusd.h>
#include "rlm_sql.h"
#ifdef HAVE_PTHREAD_H
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) {