瀏覽代碼

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.
Jan Janak 16 年之前
父節點
當前提交
1a058e14e1
共有 4 個文件被更改,包括 7 次插入5 次删除
  1. 1 2
      modules/db_mysql/km_db_mysql.c
  2. 0 1
      modules/db_mysql/km_db_mysql.h
  3. 3 2
      modules/db_mysql/km_dbase.c
  4. 3 0
      modules/db_mysql/mysql_mod.c

+ 1 - 2
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}

+ 0 - 1
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;
 

+ 3 - 2
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)));
 			}

+ 3 - 0
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}
 };