bmsd/mysql.c

changeset 852
71f0fa38b634
parent 849
16079aef4c4c
--- a/bmsd/mysql.c	Tue Oct 17 11:54:38 2023 +0200
+++ b/bmsd/mysql.c	Wed Oct 18 10:06:11 2023 +0200
@@ -74,13 +74,13 @@
 	return 1;
     }
 
-    mysql_options(con, MYSQL_OPT_RECONNECT, &reconnect);
-
     if (mysql_real_connect(con, Config.mysql_host, Config.mysql_user, Config.mysql_pass, Config.mysql_database, Config.mysql_port, NULL, 0) == NULL) {
 	syslog(LOG_NOTICE, "MySQL: mysql_real_connect() %s", mysql_error(con));
 	return 2;
     }
 
+    mysql_optionsv(con, MYSQL_OPT_RECONNECT, (void *)&reconnect);
+
     syslog(LOG_NOTICE, "MySQL: connected to %s:%d database %s", Config.mysql_host, Config.mysql_port, Config.mysql_database);
     syslog(LOG_NOTICE, "MySQL: %s server info: %s", mysql_get_host_info(con), mysql_get_server_info(con));
     if (debug)

mercurial