Browse code

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 authored on 17/02/2009 10:04:29
Showing 4 changed files
... ...
@@ -47,7 +47,6 @@
47 47
 
48 48
 #include <mysql/mysql.h>
49 49
 
50
-unsigned int db_mysql_ping_interval = 5 * 60; /* Default is 5 minutes */
51 50
 unsigned int db_mysql_timeout_interval = 2;   /* Default is 6 seconds */
52 51
 unsigned int db_mysql_auto_reconnect = 1;     /* Default is enabled   */
53 52
 
... ...
@@ -67,7 +66,7 @@ static kam_cmd_export_t cmds[] = {
67 66
  * Exported parameters
68 67
  */
69 68
 static param_export_t params[] = {
70
-	{"ping_interval",    INT_PARAM, &db_mysql_ping_interval},
69
+/*	{"ping_interval",    INT_PARAM, &db_mysql_ping_interval}, */
71 70
 	{"timeout_interval", INT_PARAM, &db_mysql_timeout_interval},
72 71
 	{"auto_reconnect",   INT_PARAM, &db_mysql_auto_reconnect},
73 72
 	{0, 0, 0}
... ...
@@ -40,7 +40,6 @@
40 40
 
41 41
 #include "../../lib/srdb1/db.h"
42 42
 
43
-extern unsigned int db_mysql_ping_interval;
44 43
 extern unsigned int db_mysql_timeout_interval;
45 44
 extern unsigned int db_mysql_auto_reconnect;
46 45
 
... ...
@@ -42,6 +42,7 @@
42 42
 #include "../../dprint.h"
43 43
 #include "../../lib/srdb1/db_query.h"
44 44
 #include "../../lib/srdb1/db_ut.h"
45
+#include "mysql_mod.h"
45 46
 #include "km_val.h"
46 47
 #include "km_my_con.h"
47 48
 #include "km_res.h"
... ...
@@ -75,9 +76,9 @@ static int db_mysql_submit_query(const db1_con_t* _h, const str* _s)
75 76
 		return -1;
76 77
 	}
77 78
 
78
-	if (db_mysql_ping_interval) {
79
+	if (my_ping_interval) {
79 80
 		t = time(0);
80
-		if ((t - CON_TIMESTAMP(_h)) > db_mysql_ping_interval) {
81
+		if ((t - CON_TIMESTAMP(_h)) > my_ping_interval) {
81 82
 			if (mysql_ping(CON_CONNECTION(_h))) {
82 83
 				LM_WARN("driver error on ping: %s\n", mysql_error(CON_CONNECTION(_h)));
83 84
 			}
... ...
@@ -97,6 +97,9 @@ static param_export_t params[] = {
97 97
 	{"send_timeout",    PARAM_INT, &my_send_to},
98 98
 	{"receive_timeout", PARAM_INT, &my_recv_to},
99 99
 	{"retries",         PARAM_INT, &my_retries},
100
+
101
+	{"timeout_interval", INT_PARAM, &db_mysql_timeout_interval},
102
+	{"auto_reconnect",   INT_PARAM, &db_mysql_auto_reconnect},
100 103
 	{0, 0, 0}
101 104
 };
102 105