dialog Make sure statistics are updated when initializing from database
authorOlle E. Johansson <oej@edvina.net>
Wed, 11 May 2016 19:59:44 +0000 (21:59 +0200)
committerOlle E. Johansson <oej@edvina.net>
Wed, 11 May 2016 19:59:44 +0000 (21:59 +0200)
Issue #424

modules/dialog/dlg_db_handler.c
modules/dialog/dlg_handlers.c
modules/dialog/dlg_hash.c
modules/dialog/dlg_var.c
modules/dialog/dlg_var.h

index e27f8b2..1933849 100644 (file)
@@ -37,6 +37,7 @@
 #include "../../lib/srdb1/db.h"
 #include "../../str.h"
 #include "../../socket_info.h"
+#include "../../lib/kcore/statistics.h"
 #include "dlg_hash.h"
 #include "dlg_var.h"
 #include "dlg_profile.h"
@@ -377,8 +378,10 @@ static int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows)
                        if (dlg->state==DLG_STATE_CONFIRMED_NA ||
                        dlg->state==DLG_STATE_CONFIRMED) {
                                active_dlgs_cnt++;
+                               if_update_stat(dlg_enable_stats, active_dlgs, 1);
                        } else if (dlg->state==DLG_STATE_EARLY) {
                                early_dlgs_cnt++;
+                               if_update_stat(dlg_enable_stats, early_dlgs, 1);
                        }
 
                        dlg->tl.timeout = (unsigned int)(VAL_INT(values+9));
index 36a807f..c5c748e 100644 (file)
@@ -70,11 +70,6 @@ int              spiral_detected = -1;
 
 extern struct rr_binds d_rrb;          /*!< binding to record-routing module */
 
-/* statistic variables */
-extern stat_var *early_dlgs;           /*!< number of early dialogs */
-extern stat_var *processed_dlgs;       /*!< number of processed dialogs */
-extern stat_var *expired_dlgs;         /*!< number of expired dialogs */
-extern stat_var *failed_dlgs;          /*!< number of failed dialogs */
 
 extern pv_elem_t *ruri_param_model;    /*!< pv-string to get r-uri */
 
index 9a96f1b..1f0470e 100644 (file)
@@ -35,6 +35,7 @@
 #include "../../ut.h"
 #include "../../hashes.h"
 #include "../../lib/kmi/mi.h"
+#include "../../lib/kcore/statistics.h"
 #include "dlg_timer.h"
 #include "dlg_var.h"
 #include "dlg_hash.h"
index 8d76b8f..e89ee27 100644 (file)
@@ -29,6 +29,7 @@
 #include "../../route.h"
 #include "../../script_cb.h"
 #include "../../pvapi.h"
+#include "../../lib/kcore/statistics.h"
 
 #include "dlg_var.h"
 #include "dlg_hash.h"
index 7d4c360..dbf7505 100644 (file)
@@ -76,6 +76,13 @@ int set_dlg_variable_unsafe(dlg_cell_t *dlg, str *key, str *val);
 
 extern dlg_ctx_t _dlg_ctx;
 
+/* statistic variables */
+extern stat_var *active_dlgs;          /*!< number of active dialogs */
+extern stat_var *early_dlgs;           /*!< number of early dialogs */
+extern stat_var *processed_dlgs;       /*!< number of processed dialogs */
+extern stat_var *expired_dlgs;         /*!< number of expired dialogs */
+extern stat_var *failed_dlgs;          /*!< number of failed dialogs */
+
 int pv_get_dlg_ctx(sip_msg_t *msg,  pv_param_t *param,
                pv_value_t *res);
 int pv_set_dlg_ctx(sip_msg_t *msg, pv_param_t *param,