From e10e647af2ab477d3e1a1a01b15fc6d9c0774ac6 Mon Sep 17 00:00:00 2001 From: Nick Altmann Date: Tue, 24 Nov 2015 03:02:01 +0300 Subject: [PATCH 1/2] uac_registrant: avoid bulk re-registrations on large servers with active using of reg_reload --- modules/uac_registrant/registrant.c | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/modules/uac_registrant/registrant.c b/modules/uac_registrant/registrant.c index 1d75d9ec164..bc33b1c9cfc 100644 --- a/modules/uac_registrant/registrant.c +++ b/modules/uac_registrant/registrant.c @@ -824,6 +824,36 @@ static struct mi_root* mi_reg_list(struct mi_root* cmd, void* param) return rpl_tree; } +int run_compare_rec(void *e_data, void *data, void *r_data) +{ + reg_record_t *old_rec = (reg_record_t*)e_data; + reg_record_t *new_rec = (reg_record_t*)data; + + if ((old_rec->state == REGISTERED_STATE) && + (str_strcmp(&old_rec->td.rem_uri, &new_rec->td.rem_uri) == 0)) { + memcpy(new_rec->td.id.call_id.s, old_rec->td.id.call_id.s, + new_rec->td.id.call_id.len); + memcpy(new_rec->td.id.loc_tag.s, old_rec->td.id.loc_tag.s, + new_rec->td.id.loc_tag.len); + new_rec->td.loc_seq.value = old_rec->td.loc_seq.value; + new_rec->last_register_sent = old_rec->last_register_sent; + new_rec->registration_timeout = old_rec->registration_timeout; + new_rec->state = old_rec->state; + } + return 0; +} + +int run_find_same_rec(void *e_data, void *data, void *r_data) +{ + reg_record_t *new_rec = (reg_record_t*)e_data; + int i; + + for(i=0; i Date: Mon, 14 Dec 2015 08:18:15 +0300 Subject: [PATCH 2/2] uac_registrant: remove redundant loop --- modules/uac_registrant/registrant.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/uac_registrant/registrant.c b/modules/uac_registrant/registrant.c index bc33b1c9cfc..6326b34d5c9 100644 --- a/modules/uac_registrant/registrant.c +++ b/modules/uac_registrant/registrant.c @@ -846,11 +846,9 @@ int run_compare_rec(void *e_data, void *data, void *r_data) int run_find_same_rec(void *e_data, void *data, void *r_data) { reg_record_t *new_rec = (reg_record_t*)e_data; - int i; + int i = (int*)data; - for(i=0; i