Module: sip-router
Branch: janakj/mysql
Commit: 1a058e14e1ae0b316c05999d088db2d0fdec03b3
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1a058e1…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Feb 17 11:04:29 2009 +0100
Export kamailio/db_mysql parameters through the module api.
All parameters original exported by kamailio/db_mysql are now exported
thought the api of the merged module in sip-router/modules/db_mysql.
The parameter ping_interval is already present in the sources coming
from ser, so we removed the original parameter from kamailio and used
the one coming from ser.
---
modules/db_mysql/km_db_mysql.c | 3 +--
modules/db_mysql/km_db_mysql.h | 1 -
modules/db_mysql/km_dbase.c | 5 +++--
modules/db_mysql/mysql_mod.c | 3 +++
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/db_mysql/km_db_mysql.c b/modules/db_mysql/km_db_mysql.c
index eb17726..5c564b1 100644
--- a/modules/db_mysql/km_db_mysql.c
+++ b/modules/db_mysql/km_db_mysql.c
@@ -47,7 +47,6 @@
#include <mysql/mysql.h>
-unsigned int db_mysql_ping_interval = 5 * 60; /* Default is 5 minutes */
unsigned int db_mysql_timeout_interval = 2; /* Default is 6 seconds */
unsigned int db_mysql_auto_reconnect = 1; /* Default is enabled */
@@ -67,7 +66,7 @@ static kam_cmd_export_t cmds[] = {
* Exported parameters
*/
static param_export_t params[] = {
- {"ping_interval", INT_PARAM, &db_mysql_ping_interval},
+/* {"ping_interval", INT_PARAM, &db_mysql_ping_interval}, */
{"timeout_interval", INT_PARAM, &db_mysql_timeout_interval},
{"auto_reconnect", INT_PARAM, &db_mysql_auto_reconnect},
{0, 0, 0}
diff --git a/modules/db_mysql/km_db_mysql.h b/modules/db_mysql/km_db_mysql.h
index fa6b698..b0b475e 100644
--- a/modules/db_mysql/km_db_mysql.h
+++ b/modules/db_mysql/km_db_mysql.h
@@ -40,7 +40,6 @@
#include "../../lib/srdb1/db.h"
-extern unsigned int db_mysql_ping_interval;
extern unsigned int db_mysql_timeout_interval;
extern unsigned int db_mysql_auto_reconnect;
diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index 6294a02..49ab55a 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -42,6 +42,7 @@
#include "../../dprint.h"
#include "../../lib/srdb1/db_query.h"
#include "../../lib/srdb1/db_ut.h"
+#include "mysql_mod.h"
#include "km_val.h"
#include "km_my_con.h"
#include "km_res.h"
@@ -75,9 +76,9 @@ static int db_mysql_submit_query(const db1_con_t* _h, const str* _s)
return -1;
}
- if (db_mysql_ping_interval) {
+ if (my_ping_interval) {
t = time(0);
- if ((t - CON_TIMESTAMP(_h)) > db_mysql_ping_interval) {
+ if ((t - CON_TIMESTAMP(_h)) > my_ping_interval) {
if (mysql_ping(CON_CONNECTION(_h))) {
LM_WARN("driver error on ping: %s\n", mysql_error(CON_CONNECTION(_h)));
}
diff --git a/modules/db_mysql/mysql_mod.c b/modules/db_mysql/mysql_mod.c
index bc9f3bb..61c2683 100644
--- a/modules/db_mysql/mysql_mod.c
+++ b/modules/db_mysql/mysql_mod.c
@@ -97,6 +97,9 @@ static param_export_t params[] = {
{"send_timeout", PARAM_INT, &my_send_to},
{"receive_timeout", PARAM_INT, &my_recv_to},
{"retries", PARAM_INT, &my_retries},
+
+ {"timeout_interval", INT_PARAM, &db_mysql_timeout_interval},
+ {"auto_reconnect", INT_PARAM, &db_mysql_auto_reconnect},
{0, 0, 0}
};