Module: kamailio
Branch: master
Commit: 10ce2e5e1b6a2e158ce031487426230afb370682
URL:
https://github.com/kamailio/kamailio/commit/10ce2e5e1b6a2e158ce031487426230…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: 2015-01-20T10:59:25+02:00
modules/ims_registrar_scscf: new parameter notification_list_size_threshold. Once the
notification list exceeds this size a warning is logged.
---
Modified: modules/ims_registrar_scscf/reg_mod.c
Modified: modules/ims_registrar_scscf/registrar_notify.c
Modified: modules/ims_registrar_scscf/registrar_notify.h
---
Diff:
https://github.com/kamailio/kamailio/commit/10ce2e5e1b6a2e158ce031487426230…
Patch:
https://github.com/kamailio/kamailio/commit/10ce2e5e1b6a2e158ce031487426230…
---
diff --git a/modules/ims_registrar_scscf/reg_mod.c
b/modules/ims_registrar_scscf/reg_mod.c
index 87ec202..f1ced68 100644
--- a/modules/ims_registrar_scscf/reg_mod.c
+++ b/modules/ims_registrar_scscf/reg_mod.c
@@ -156,6 +156,8 @@ int subscription_min_expires = 10; /**< minimum subscription
expiration time *
int subscription_max_expires = 1000000; /**< maximum subscription expiration time
*/
int subscription_expires_range = 0;
+int notification_list_size_threshold = 0; /**Threshold for size of notification list
after which a warning is logged */
+
extern reg_notification_list *notification_list; /**< list of notifications for reg to
be sent */
@@ -251,6 +253,7 @@ static param_export_t params[] = {
{"ue_unsubscribe_on_dereg", INT_PARAM, &ue_unsubscribe_on_dereg},
{"subscription_expires_range", INT_PARAM,
&subscription_expires_range},
{"user_data_always", INT_PARAM, &user_data_always},
+ {"notification_list_size_threshold", INT_PARAM,
¬ification_list_size_threshold},
{0, 0, 0}
};
diff --git a/modules/ims_registrar_scscf/registrar_notify.c
b/modules/ims_registrar_scscf/registrar_notify.c
index 38762c0..2ab9ec0 100644
--- a/modules/ims_registrar_scscf/registrar_notify.c
+++ b/modules/ims_registrar_scscf/registrar_notify.c
@@ -77,6 +77,8 @@ reg_notification_list *notification_list = 0; //< List of pending
notifications
extern struct tm_binds tmb;
+extern int notification_list_size_threshold;
+
extern int subscription_default_expires;
extern int subscription_min_expires;
extern int subscription_max_expires;
@@ -121,6 +123,7 @@ int notify_init() {
return 0;
}
notification_list->lock = lock_init(notification_list->lock);
+ notification_list->size = 0;
sem_new(notification_list->empty, 0); //pre-locked - as we assume list is empty at
start
return 1;
}
@@ -1995,6 +1998,11 @@ void add_notification(reg_notification * n) {
if (notification_list->tail) notification_list->tail->next = n;
notification_list->tail = n;
if (!notification_list->head) notification_list->head = n;
+ notification_list->size++;
+ if(notification_list_size_threshold > 0 && notification_list->size >
notification_list_size_threshold) {
+ LM_WARN("notification_list is size [%d] and has exceed
notification_list_size_threshold of [%d]", notification_list->size,
notification_list_size_threshold);
+ }
+
sem_release(notification_list->empty);
lock_release(notification_list->lock);
}
@@ -2019,6 +2027,7 @@ reg_notification* get_notification() {
notification_list->tail = 0;
}
n->next = 0; //make sure whoever gets this cant access our list
+ notification_list->size--;
lock_release(notification_list->lock);
return n;
diff --git a/modules/ims_registrar_scscf/registrar_notify.h
b/modules/ims_registrar_scscf/registrar_notify.h
index 3dd8c17..1a44412 100644
--- a/modules/ims_registrar_scscf/registrar_notify.h
+++ b/modules/ims_registrar_scscf/registrar_notify.h
@@ -88,6 +88,7 @@ typedef struct {
reg_notification *head; /**< first notification in the list */
reg_notification *tail; /**< last notification in the list */
gen_sem_t *empty;
+ int size;
} reg_notification_list;
/** Events for subscriptions */