[prelude-cvslog] r9907 - libpreludedb/trunk/plugins/sql/mysql
noreply at prelude-ids.org
noreply at prelude-ids.org
Wed Sep 12 15:52:42 CEST 2007
Author: yoann
Date: 2007-09-12 15:52:40 +0200 (Wed, 12 Sep 2007)
New Revision: 9907
Modified:
libpreludedb/trunk/plugins/sql/mysql/mysql.c
Log:
Prevent MySQL session from timing out after 8 hours of inactivity.
Upon connection to the MySQL server, set the wait_timeout session
variable to 31536000 seconds (365 days).
Modified: libpreludedb/trunk/plugins/sql/mysql/mysql.c
===================================================================
--- libpreludedb/trunk/plugins/sql/mysql/mysql.c 2007-09-12 13:48:17 UTC (rev 9906)
+++ libpreludedb/trunk/plugins/sql/mysql/mysql.c 2007-09-12 13:52:40 UTC (rev 9907)
@@ -48,8 +48,7 @@
#include "preludedb.h"
-int mysql_LTX_prelude_plugin_version(void);
-int mysql_LTX_preludedb_plugin_init(prelude_plugin_entry_t *pe, void *data);
+#define WAIT_TIMEOUT_VALUE "31536000" /* 365 days */
#if ! defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID < 32224
@@ -57,6 +56,10 @@
#endif /* ! MYSQL_VERSION_ID */
+int mysql_LTX_prelude_plugin_version(void);
+int mysql_LTX_preludedb_plugin_init(prelude_plugin_entry_t *pe, void *data);
+
+
static prelude_bool_t is_connection_broken(void *session)
{
switch (mysql_errno(session)) {
@@ -118,6 +121,8 @@
return ret;
}
+ mysql_query(*session, "SET SESSION wait_timeout=" WAIT_TIMEOUT_VALUE);
+
return 0;
}
More information about the Prelude-cvslog
mailing list