From e427af0ee33c24e7fc41d3283a6f20133aa19bce Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Sat, 4 Jul 2015 07:07:56 +0200 Subject: [PATCH] MT#10339 CARRIER: usrloc_dbro.patch Change-Id: I894ab9c319853e29b492a84f33a07290e562dfef --- debian/patches/series | 2 +- debian/patches/sipwise/usrloc_dbro.patch | 67 +++++++++++------------- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/debian/patches/series b/debian/patches/series index a009bf2ae..d1620e686 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -14,5 +14,5 @@ sipwise/add_pcem_module.patch sipwise/lcr_rate_module.patch sipwise/parallel_build.patch sipwise/tcap.patch -#TODO#sipwise/usrloc_dbro.patch +sipwise/usrloc_dbro.patch #TODO#sipwise/nathelper_socket_filter.patch diff --git a/debian/patches/sipwise/usrloc_dbro.patch b/debian/patches/sipwise/usrloc_dbro.patch index db2d16526..bc97d9d45 100644 --- a/debian/patches/sipwise/usrloc_dbro.patch +++ b/debian/patches/sipwise/usrloc_dbro.patch @@ -1,6 +1,19 @@ +From d06e1643603a23f2a5bf7eabae1113c15feb61f6 Mon Sep 17 00:00:00 2001 +From: Victor Seva +Date: Mon, 5 Jan 2015 17:27:09 +0100 +Subject: [PATCH] MT#9205: usrloc: add db_url_ro parameter + +Add ro connection per child +--- + modules/usrloc/ul_mod.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ + modules/usrloc/ul_mod.h | 2 ++ + 2 files changed, 67 insertions(+) + +diff --git a/modules/usrloc/ul_mod.c b/modules/usrloc/ul_mod.c +index 1ad69e3..5f56f0c 100644 --- a/modules/usrloc/ul_mod.c +++ b/modules/usrloc/ul_mod.c -@@ -157,6 +157,7 @@ +@@ -155,6 +155,7 @@ str ulattrs_avalue_col = str_init(ULATTRS_AVALUE_COL); /*!< Name of column conta str ulattrs_last_mod_col = str_init(ULATTRS_LAST_MOD_COL); /*!< Name of column containing the last modified date */ str db_url = str_init(DEFAULT_DB_URL); /*!< Database URL */ @@ -8,7 +21,7 @@ int timer_interval = 60; /*!< Timer interval in seconds */ int db_mode = 0; /*!< Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */ int use_domain = 0; /*!< Whether usrloc should use domain part of aor */ -@@ -173,6 +174,8 @@ +@@ -173,6 +174,8 @@ unsigned int init_flag = 0; db1_con_t* ul_dbh = 0; /* Database connection handle */ db_func_t ul_dbf; @@ -17,15 +30,15 @@ /*! \brief -@@ -199,6 +202,7 @@ - {"flags_column", STR_PARAM, &flags_col.s }, - {"cflags_column", STR_PARAM, &cflags_col.s }, - {"db_url", STR_PARAM, &db_url.s }, -+ {"db_url_ro", STR_PARAM, &db_url_ro.s }, +@@ -199,6 +202,7 @@ static param_export_t params[] = { + {"flags_column", PARAM_STR, &flags_col }, + {"cflags_column", PARAM_STR, &cflags_col }, + {"db_url", PARAM_STR, &db_url }, ++ {"db_url_ro", PARAM_STR, &db_url_ro.s }, {"timer_interval", INT_PARAM, &timer_interval }, {"db_mode", INT_PARAM, &db_mode }, {"use_domain", INT_PARAM, &use_domain }, -@@ -264,6 +268,38 @@ +@@ -271,6 +275,38 @@ struct module_exports exports = { child_init /*!< Child initialization function */ }; @@ -64,15 +77,7 @@ /*! \brief * Module initialization function -@@ -316,6 +352,7 @@ - reg_id_col.len = strlen(reg_id_col.s); - last_mod_col.len = strlen(last_mod_col.s); - db_url.len = strlen(db_url.s); -+ if(db_url_ro.s) db_url_ro.len = strlen(db_url_ro.s); - - if(ul_xavp_contact_name.s!=NULL) - ul_xavp_contact_name.len = strlen(ul_xavp_contact_name.s); -@@ -374,6 +411,21 @@ +@@ -357,6 +393,21 @@ static int mod_init(void) } } @@ -94,15 +99,7 @@ if (nat_bflag==(unsigned int)-1) { nat_bflag = 0; } else if ( nat_bflag>=8*sizeof(nat_bflag) ) { -@@ -398,7 +450,6 @@ - return 0; - } - -- - static int child_init(int _rank) - { - dlist_t* ptr; -@@ -447,6 +498,16 @@ +@@ -430,6 +481,16 @@ static int child_init(int _rank) LM_ERR("child(%d): failed to connect to database\n", _rank); return -1; } @@ -119,16 +116,7 @@ /* _rank==PROC_SIPINIT is used even when fork is disabled */ if (_rank==PROC_SIPINIT && db_mode!=DB_ONLY) { /* if cache is used, populate domains from DB */ -@@ -480,6 +541,8 @@ - } - } - -+ if (db_mode == DB_ONLY) -+ - if(sruid_init(&_ul_sruid, '-', "ulcx", SRUID_INC)<0) - return -1; - done = 1; -@@ -502,6 +565,10 @@ +@@ -485,6 +546,10 @@ static void destroy(void) ul_dbf.close(ul_dbh); } @@ -139,9 +127,11 @@ free_all_udomains(); ul_destroy_locks(); +diff --git a/modules/usrloc/ul_mod.h b/modules/usrloc/ul_mod.h +index 1e3b08d..acb3ef9 100644 --- a/modules/usrloc/ul_mod.h +++ b/modules/usrloc/ul_mod.h -@@ -96,6 +96,8 @@ +@@ -98,6 +98,8 @@ extern str ul_xavp_contact_name; extern db1_con_t* ul_dbh; /* Database connection handle */ extern db_func_t ul_dbf; @@ -150,3 +140,6 @@ /* * Matching algorithms +-- +2.1.4 +