kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
December 2018
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
23 participants
313 discussions
Start a n
N
ew thread
git:master:0d843f5f: acc_radius: use mem error macros
by Victor Seva
Module: kamailio Branch: master Commit: 0d843f5f51750d51b66a5f0501320cb461072c26 URL:
https://github.com/kamailio/kamailio/commit/0d843f5f51750d51b66a5f0501320cb…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2018-12-28T15:38:09+01:00 acc_radius: use mem error macros --- Modified: src/modules/acc_radius/acc_radius_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/0d843f5f51750d51b66a5f0501320cb…
Patch:
https://github.com/kamailio/kamailio/commit/0d843f5f51750d51b66a5f0501320cb…
--- diff --git a/src/modules/acc_radius/acc_radius_mod.c b/src/modules/acc_radius/acc_radius_mod.c index adbfe18b00..b4e74c6656 100644 --- a/src/modules/acc_radius/acc_radius_mod.c +++ b/src/modules/acc_radius/acc_radius_mod.c @@ -184,7 +184,7 @@ static int acc_api_fixup(void **param, int param_no) if(param_no == 1) { accp = (struct acc_param *)pkg_malloc(sizeof(struct acc_param)); if(!accp) { - LM_ERR("no more pkg mem\n"); + PKG_MEM_ERROR; return E_OUT_OF_MEM; } memset(accp, 0, sizeof(struct acc_param));
5 years, 11 months
1
0
0
0
git:master:8e2ae178: acc_diameter: use mem error macros
by Victor Seva
Module: kamailio Branch: master Commit: 8e2ae17802e03153b23fbc4d30fd10ae1717aa4d URL:
https://github.com/kamailio/kamailio/commit/8e2ae17802e03153b23fbc4d30fd10a…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2018-12-28T15:35:52+01:00 acc_diameter: use mem error macros --- Modified: src/modules/acc_diameter/acc_diameter_mod.c Modified: src/modules/acc_diameter/diam_avp.c Modified: src/modules/acc_diameter/diam_message.c Modified: src/modules/acc_diameter/diam_tcp.c --- Diff:
https://github.com/kamailio/kamailio/commit/8e2ae17802e03153b23fbc4d30fd10a…
Patch:
https://github.com/kamailio/kamailio/commit/8e2ae17802e03153b23fbc4d30fd10a…
5 years, 11 months
1
0
0
0
git:master:b5c40df3: acc: use mem error macros
by Victor Seva
Module: kamailio Branch: master Commit: b5c40df3d75fc664505f80ea2fefd8bc3cb47868 URL:
https://github.com/kamailio/kamailio/commit/b5c40df3d75fc664505f80ea2fefd8b…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2018-12-28T13:52:56+01:00 acc: use mem error macros --- Modified: src/modules/acc/acc_extra.c Modified: src/modules/acc/acc_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/b5c40df3d75fc664505f80ea2fefd8b…
Patch:
https://github.com/kamailio/kamailio/commit/b5c40df3d75fc664505f80ea2fefd8b…
--- diff --git a/src/modules/acc/acc_extra.c b/src/modules/acc/acc_extra.c index c92995beaf..5e8568535e 100644 --- a/src/modules/acc/acc_extra.c +++ b/src/modules/acc/acc_extra.c @@ -115,7 +115,7 @@ struct acc_extra *parse_acc_extra(char *extra_str) } extra = (struct acc_extra*)pkg_malloc(sizeof(struct acc_extra)); if (extra==0) { - LM_ERR("no more pkg mem 1\n"); + PKG_MEM_ERROR; goto error; } memset( extra, 0, sizeof(struct acc_extra)); @@ -237,7 +237,7 @@ int extra2strar(struct acc_extra *extra, struct sip_msg *rq, str *val_arr, } else { val_arr[n].s = (char *)pkg_malloc(value.rs.len); if (val_arr[n].s == NULL ) { - LM_ERR("out of memory.\n"); + PKG_MEM_ERROR; /* Cleanup already allocated memory and * return that we didn't do anything */ for (i = 0; i < n ; i++) { diff --git a/src/modules/acc/acc_mod.c b/src/modules/acc/acc_mod.c index cde32146b9..a4f9a64265 100644 --- a/src/modules/acc/acc_mod.c +++ b/src/modules/acc/acc_mod.c @@ -165,7 +165,7 @@ static int _acc_module_initialized = 0; static int acc_fixup(void** param, int param_no); static int free_acc_fixup(void** param, int param_no); - +/* clang-format off */ static cmd_export_t cmds[] = { {"acc_log_request", (cmd_function)w_acc_log_request, 1, acc_fixup, free_acc_fixup, @@ -242,14 +242,14 @@ struct module_exports exports= { DEFAULT_DLFLAGS, /* dlopen flags */ cmds, /* exported functions */ params, /* exported params */ - 0, /* RPC method exports */ + 0, /* RPC method exports */ 0, /* exported pseudo-variables */ 0, /* response function */ mod_init, /* initialization module */ child_init, /* per-child init function */ destroy /* destroy function */ }; - +/* clang-format on */ /************************** FIXUP functions ****************************/ @@ -268,7 +268,7 @@ static int acc_fixup(void** param, int param_no) if (param_no == 1) { accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param)); if (!accp) { - LM_ERR("no more pkg mem\n"); + PKG_MEM_ERROR; return E_OUT_OF_MEM; } memset( accp, 0, sizeof(struct acc_param)); @@ -664,7 +664,7 @@ static int acc_register_engine(acc_engine_t *eng) e = (acc_engine_t*)pkg_malloc(sizeof(acc_engine_t)); if(e ==NULL) { - LM_ERR("no more pkg\n"); + PKG_MEM_ERROR; return -1; } memcpy(e, eng, sizeof(acc_engine_t));
5 years, 11 months
1
0
0
0
git:master:851fe7f7: core: use SHM_MEM_ERROR helper define after commit 4c57d02e
by Henning Westerholt
Module: kamailio Branch: master Commit: 851fe7f7de78a41c9e0e1b67d437201bb49b7941 URL:
https://github.com/kamailio/kamailio/commit/851fe7f7de78a41c9e0e1b67d437201…
Author: Henning Westerholt <hw(a)kamailio.org> Committer: Henning Westerholt <hw(a)kamailio.org> Date: 2018-12-28T12:14:26+01:00 core: use SHM_MEM_ERROR helper define after commit 4c57d02e --- Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/851fe7f7de78a41c9e0e1b67d437201…
Patch:
https://github.com/kamailio/kamailio/commit/851fe7f7de78a41c9e0e1b67d437201…
--- diff --git a/src/main.c b/src/main.c index ad992a56be..ac58b760ba 100644 --- a/src/main.c +++ b/src/main.c @@ -1271,7 +1271,7 @@ int main_loop(void) if(_sr_instance_started == NULL) { _sr_instance_started = shm_malloc(sizeof(int)); if(_sr_instance_started == NULL) { - LM_ERR("no shared memory\n"); + SHM_MEM_ERROR; goto error; } *_sr_instance_started = 0;
5 years, 11 months
1
0
0
0
git:master:dc03199e: core: rename sdp parser USE_PKG_MEM and USE_SHM_MEM #define, prevent core mix-up
by Henning Westerholt
Module: kamailio Branch: master Commit: dc03199eaa7368003f3d2c188322e23d9c8512eb URL:
https://github.com/kamailio/kamailio/commit/dc03199eaa7368003f3d2c188322e23…
Author: Henning Westerholt <hw(a)kamailio.org> Committer: Henning Westerholt <hw(a)kamailio.org> Date: 2018-12-28T12:11:31+01:00 core: rename sdp parser USE_PKG_MEM and USE_SHM_MEM #define, prevent core mix-up --- Modified: src/core/parser/sdp/sdp.c --- Diff:
https://github.com/kamailio/kamailio/commit/dc03199eaa7368003f3d2c188322e23…
Patch:
https://github.com/kamailio/kamailio/commit/dc03199eaa7368003f3d2c188322e23…
--- diff --git a/src/core/parser/sdp/sdp.c b/src/core/parser/sdp/sdp.c index b4c9ffcaa3..7dbf259379 100644 --- a/src/core/parser/sdp/sdp.c +++ b/src/core/parser/sdp/sdp.c @@ -35,8 +35,8 @@ #include "sdp.h" #include "sdp_helpr_funcs.h" -#define USE_PKG_MEM 0 -#define USE_SHM_MEM 1 +#define SDP_USE_PKG_MEM 0 +#define SDP_USE_SHM_MEM 1 #define HOLD_IP_STR "0.0.0.0" #define HOLD_IP_LEN 7 @@ -179,18 +179,18 @@ static inline sdp_payload_attr_t** init_p_payload_attr(sdp_stream_cell_t* _strea LM_ERR("Invalid number of payloads\n"); return NULL; } - if (pkg == USE_PKG_MEM) { + if (pkg == SDP_USE_PKG_MEM) { _stream->p_payload_attr = (sdp_payload_attr_t**)pkg_malloc(payloads_num * sizeof(sdp_payload_attr_t*)); - } else if (pkg == USE_SHM_MEM) { + } else if (pkg == SDP_USE_SHM_MEM) { _stream->p_payload_attr = (sdp_payload_attr_t**)shm_malloc(payloads_num * sizeof(sdp_payload_attr_t*)); } else { LM_ERR("undefined memory type\n"); return NULL; } if (_stream->p_payload_attr == NULL) { - if (pkg == USE_PKG_MEM) { + if (pkg == SDP_USE_PKG_MEM) { PKG_MEM_ERROR; - } else if (pkg == USE_SHM_MEM) { + } else if (pkg == SDP_USE_SHM_MEM) { SHM_MEM_ERROR; } return NULL; @@ -531,7 +531,7 @@ static int parse_sdp_session(str *sdp_body, int session_num, str *cnt_disp, sdp_ } /* Initialize fast access pointers */ - if (NULL == init_p_payload_attr(stream, USE_PKG_MEM)) { + if (NULL == init_p_payload_attr(stream, SDP_USE_PKG_MEM)) { return -1; } parse_payload_attr = 1; @@ -1082,7 +1082,7 @@ sdp_stream_cell_t * clone_sdp_stream_cell(sdp_stream_cell_t *stream) clone_stream->payloads_num = stream->payloads_num; if (clone_stream->payloads_num) { - if (NULL == init_p_payload_attr(clone_stream, USE_SHM_MEM)) { + if (NULL == init_p_payload_attr(clone_stream, SDP_USE_SHM_MEM)) { goto error; } } @@ -1319,3 +1319,5 @@ sdp_info_t * clone_sdp_info(struct sip_msg* _m) return NULL; } +#undef SDP_USE_PKG_MEM +#undef SDP_USE_SHM_MEM
5 years, 11 months
1
0
0
0
git:master:29b569f4: core: consistently set "ser_error" internal state for all lump operations
by Henning Westerholt
Module: kamailio Branch: master Commit: 29b569f499bfe810d4e4aef7259c91dcc8c26e0b URL:
https://github.com/kamailio/kamailio/commit/29b569f499bfe810d4e4aef7259c91d…
Author: Henning Westerholt <hw(a)kamailio.org> Committer: Henning Westerholt <hw(a)kamailio.org> Date: 2018-12-28T12:11:31+01:00 core: consistently set "ser_error" internal state for all lump operations --- Modified: src/core/data_lump.c --- Diff:
https://github.com/kamailio/kamailio/commit/29b569f499bfe810d4e4aef7259c91d…
Patch:
https://github.com/kamailio/kamailio/commit/29b569f499bfe810d4e4aef7259c91d…
--- diff --git a/src/core/data_lump.c b/src/core/data_lump.c index 5a1acb14d5..007c5de2cc 100644 --- a/src/core/data_lump.c +++ b/src/core/data_lump.c @@ -57,6 +57,7 @@ struct lump* append_new_lump(struct lump** list, char* new_hdr, tmp=pkg_malloc(sizeof(struct lump)); if (tmp==0){ + ser_error=E_OUT_OF_MEM; PKG_MEM_ERROR; return 0; } @@ -83,6 +84,7 @@ struct lump* add_new_lump(struct lump** list, char* new_hdr, tmp=pkg_malloc(sizeof(struct lump)); if (tmp==0){ + ser_error=E_OUT_OF_MEM; PKG_MEM_ERROR; return 0; } @@ -108,6 +110,7 @@ struct lump* insert_new_lump(struct lump** list, char* new_hdr, tmp=pkg_malloc(sizeof(struct lump)); if (tmp==0){ + ser_error=E_OUT_OF_MEM; PKG_MEM_ERROR; return 0; } @@ -303,6 +306,7 @@ struct lump* del_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_ tmp=pkg_malloc(sizeof(struct lump)); if (tmp==0){ + ser_error=E_OUT_OF_MEM; PKG_MEM_ERROR; return 0; } @@ -536,6 +540,7 @@ static struct lump *dup_lump_list_r( struct lump *l, /* otherwise duplicate current element */ new_lump=pkg_malloc(sizeof(struct lump)); if (!new_lump) { + ser_error=E_OUT_OF_MEM; PKG_MEM_ERROR; *error=1; return 0; @@ -754,6 +759,7 @@ int sr_hdr_add(sip_msg_t *msg, str *sname, str *sbody) h.len = sname->len + 2 + sbody->len + CRLF_LEN; h.s = (char*)pkg_malloc(h.len+1); if(h.s == 0) { + ser_error=E_OUT_OF_MEM; PKG_MEM_ERROR; return -1; }
5 years, 11 months
1
0
0
0
git:master:785ede5b: rtpengine: use version number to track building rtpengine sockets on reload
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 785ede5bacfe55e88381ae8f7d672b24ec4b8cf6 URL:
https://github.com/kamailio/kamailio/commit/785ede5bacfe55e88381ae8f7d672b2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-12-28T09:56:26+01:00 rtpengine: use version number to track building rtpengine sockets on reload - check on list size fails if same list is reloaded with different attributes - reload command has a safe interval of 10 seconds between executions to allow building internal list of sockets --- Modified: src/modules/rtpengine/rtpengine.c --- Diff:
https://github.com/kamailio/kamailio/commit/785ede5bacfe55e88381ae8f7d672b2…
Patch:
https://github.com/kamailio/kamailio/commit/785ede5bacfe55e88381ae8f7d672b2…
--- diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index 46a55e6669..484ce05f35 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -169,6 +169,16 @@ struct minmax_stats_vals { long long avg_samples; /* our own running count to average the averages */ }; +#define RTPE_LIST_VERSION_DELAY 10 + +typedef struct rtpe_list_version { + int vernum; + time_t vertime; +} rtpe_list_version_t; + +static rtpe_list_version_t *_rtpe_list_version = NULL; +static int _rtpe_list_vernum_local = 0; + static char *gencookie(); static int rtpp_test(struct rtpp_node*, int, int); static int start_recording_f(struct sip_msg *, char *, char *); @@ -283,7 +293,6 @@ static struct minmax_mos_label_stats global_mos_stats, int got_any_mos_pvs; - static cmd_export_t cmds[] = { {"set_rtpengine_set", (cmd_function)set_rtpengine_set_f, 1, fixup_set_id, 0, @@ -1169,16 +1178,26 @@ static int rtpp_test_ping(struct rtpp_node *node) static void rtpengine_rpc_reload(rpc_t* rpc, void* ctx) { + time_t tnow; + if (rtpp_db_url.s == NULL) { // no database rpc->fault(ctx, 500, "No Database URL"); return; } + if(!sr_instance_ready()) { rpc->fault(ctx, 500, "Initializing - try later"); return; } + tnow = time(NULL); + if(tnow - _rtpe_list_version->vertime < RTPE_LIST_VERSION_DELAY) { + rpc->fault(ctx, 500, "Too short reload interval - try later"); + return; + } + _rtpe_list_version->vertime = tnow; + if (init_rtpproxy_db() < 0) { // fail reloading from database rpc->fault(ctx, 500, "Failed reloading db"); @@ -1186,9 +1205,15 @@ static void rtpengine_rpc_reload(rpc_t* rpc, void* ctx) } if (build_rtpp_socks(1, 1)) { - rpc->fault(ctx, 500, "Out of memory"); + rpc->fault(ctx, 500, "Failed to build rtpengine sockets"); return; } + + _rtpe_list_version->vernum += 1; + _rtpe_list_version->vertime = time(NULL); + LM_DBG("current rtpengines list version: %d (%u)\n", + _rtpe_list_version->vernum, + (unsigned int)_rtpe_list_version->vertime); } static int rtpengine_rpc_iterate(rpc_t* rpc, void* ctx, const str *rtpp_url, @@ -1473,6 +1498,14 @@ mod_init(void) unsigned short avp_flags; str s; + _rtpe_list_version = (rtpe_list_version_t*)shm_mallocxz(sizeof(rtpe_list_version_t)); + if(_rtpe_list_version==NULL) { + LM_ERR("no more shm memory for rtpe list version\n"); + return -1; + } + _rtpe_list_version->vernum = 1; + _rtpe_list_version->vertime = time(NULL); + if(rtpengine_rpc_init()<0) { LM_ERR("failed to register RPC commands\n"); @@ -1666,13 +1699,15 @@ static int build_rtpp_socks(int lmode, int rtest) { int ip_mtu_discover = IP_PMTUDISC_DONT; #endif + if(_rtpe_list_vernum_local == _rtpe_list_version->vernum) { + /* same version for the list of rtpengines */ + return 0; + } + rtpe_reload_lock_get(rtpp_no_lock); current_rtpp_no = *rtpp_no; rtpe_reload_lock_release(rtpp_no_lock); - if (current_rtpp_no == rtpp_socks_size) - return 0; - // close current sockets for (i = 0; i < rtpp_socks_size; i++) { if (rtpp_socks[i] >= 0) { @@ -1690,6 +1725,7 @@ static int build_rtpp_socks(int lmode, int rtest) { memset(rtpp_socks, -1, sizeof(int)*(rtpp_socks_size)); rtpe_reload_lock_get(rtpp_set_list->rset_head_lock); + _rtpe_list_vernum_local = _rtpe_list_version->vernum; for (rtpp_list = rtpp_set_list->rset_first; rtpp_list != 0; rtpp_list = rtpp_list->rset_next) { @@ -1948,6 +1984,10 @@ static void mod_destroy(void) } else { LM_DBG("rtpengine_hash_table_destroy() success!\n"); } + if(_rtpe_list_version!=NULL) { + shm_free(_rtpe_list_version); + _rtpe_list_version = NULL; + } }
5 years, 11 months
1
0
0
0
git:master:3d481300: rtpengine: reworked build of rtpengine sockets to avoid serial initialization
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 3d4813001052497d21804586d643697f7a68aee8 URL:
https://github.com/kamailio/kamailio/commit/3d4813001052497d21804586d643697…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-12-28T09:56:26+01:00 rtpengine: reworked build of rtpengine sockets to avoid serial initialization - do not lock during startup, change of the list of rtpengines can be done only upon reload, which is now disabled until all child processes did the init - do rtpengine testing (probing) only in one child, the status is stored in shared memory, no need to do it from each process. --- Modified: src/modules/rtpengine/rtpengine.c --- Diff:
https://github.com/kamailio/kamailio/commit/3d4813001052497d21804586d643697…
Patch:
https://github.com/kamailio/kamailio/commit/3d4813001052497d21804586d643697…
--- diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index f18a35b33d..46a55e6669 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -193,7 +193,7 @@ static struct rtpp_node *select_rtpp_node_new(str, str, int, struct rtpp_node ** static struct rtpp_node *select_rtpp_node_old(str, str, int, enum rtpe_operation); static struct rtpp_node *select_rtpp_node(str, str, int, struct rtpp_node **, int, enum rtpe_operation); static int is_queried_node(struct rtpp_node *, struct rtpp_node **, int); -static int build_rtpp_socks(); +static int build_rtpp_socks(int lmode, int rtest); static char *send_rtpp_command(struct rtpp_node *, bencode_item_t *, int *); static int get_extra_id(struct sip_msg* msg, str *id_str); @@ -1174,6 +1174,10 @@ static void rtpengine_rpc_reload(rpc_t* rpc, void* ctx) rpc->fault(ctx, 500, "No Database URL"); return; } + if(!sr_instance_ready()) { + rpc->fault(ctx, 500, "Initializing - try later"); + return; + } if (init_rtpproxy_db() < 0) { // fail reloading from database @@ -1181,7 +1185,7 @@ static void rtpengine_rpc_reload(rpc_t* rpc, void* ctx) return; } - if (build_rtpp_socks()) { + if (build_rtpp_socks(1, 1)) { rpc->fault(ctx, 500, "Out of memory"); return; } @@ -1195,7 +1199,12 @@ static int rtpengine_rpc_iterate(rpc_t* rpc, void* ctx, const str *rtpp_url, int found = RPC_FOUND_NONE, err = 0; int ret; - if (build_rtpp_socks()) { + if(!sr_instance_ready()) { + rpc->fault(ctx, 500, "Initializing - try later"); + return -1; + } + + if (build_rtpp_socks(1, 1)) { rpc->fault(ctx, 500, "Out of memory"); return -1; } @@ -1634,14 +1643,19 @@ mod_init(void) } #define rtpe_reload_lock_get(plock) do { \ - if (rtpp_db_url.s != NULL) lock_get(plock); \ + if (rtpp_db_url.s != NULL && lmode != 0) lock_get(plock); \ } while(0) #define rtpe_reload_lock_release(plock) do { \ - if (rtpp_db_url.s != NULL) lock_release(plock); \ + if (rtpp_db_url.s != NULL && lmode != 0) lock_release(plock); \ } while(0) -static int build_rtpp_socks() { +/** + * build rtp enigne sockets + * - lmode: locking mode (1 - lock if needed; 0 - no locking) + * - rtest: rtpengine testing (1 - test if active; 0 - no test done) + */ +static int build_rtpp_socks(int lmode, int rtest) { int n, i; char *cp; struct addrinfo hints, *res; @@ -1768,7 +1782,7 @@ static int build_rtpp_socks() { freeaddrinfo(res); rptest: - pnode->rn_disabled = rtpp_test(pnode, 0, 1); + if(rtest) pnode->rn_disabled = rtpp_test(pnode, 0, 1); } rtpe_reload_lock_release(rtpp_list->rset_lock); } @@ -1848,8 +1862,14 @@ child_init(int rank) memset(queried_nodes_ptr, 0, MAX_RTPP_TRIED_NODES * sizeof(struct rtpp_node*)); /* Iterate known RTP proxies - create sockets */ - if (build_rtpp_socks()) - return -1; + if(rank==PROC_SIPINIT) { + /* probe rtpengines only in first worker */ + if (build_rtpp_socks(0, 1)) + return -1; + } else { + if (build_rtpp_socks(0, 0)) + return -1; + } return 0; } @@ -2865,7 +2885,7 @@ select_rtpp_node(str callid, str viabranch, int do_test, struct rtpp_node **quer { struct rtpp_node *node = NULL; - if (build_rtpp_socks()) { + if (build_rtpp_socks(1, 0)) { LM_ERR("out of memory\n"); return NULL; }
5 years, 11 months
1
0
0
0
git:master:61c368b4: core: new rpc command - core.psa
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 61c368b406f9fd3bf40f548b2866fc254ca11670 URL:
https://github.com/kamailio/kamailio/commit/61c368b406f9fd3bf40f548b2866fc2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-12-28T09:56:26+01:00 core: new rpc command - core.psa - print attributes stored in process table, similar to core.psx, but also prints the rank and status fields --- Modified: src/core/core_cmd.c --- Diff:
https://github.com/kamailio/kamailio/commit/61c368b406f9fd3bf40f548b2866fc2…
Patch:
https://github.com/kamailio/kamailio/commit/61c368b406f9fd3bf40f548b2866fc2…
--- diff --git a/src/core/core_cmd.c b/src/core/core_cmd.c index bfa962b567..ea38e60bae 100644 --- a/src/core/core_cmd.c +++ b/src/core/core_cmd.c @@ -438,6 +438,28 @@ static void core_psx(rpc_t* rpc, void* c) } } +static const char* core_psa_doc[] = { + "Return all the attributes of running.", + /* Documentation string */ + 0 /* Method signature(s) */ +}; + + +static void core_psa(rpc_t* rpc, void* c) +{ + int p; + void *handle; + + for (p=0; p<*process_count;p++) { + rpc->add(c, "{", &handle); + rpc->struct_add(handle, "dddds", + "index", p, + "pid", pt[p].pid, + "status", pt[p].status, + "rank", pt[p].rank, + "description", pt[p].desc); + } +} static const char* core_pwd_doc[] = { "Returns the working directory of server.", /* Documentation string */ @@ -1058,6 +1080,7 @@ static rpc_export_t core_rpc_methods[] = { {"core.uptime", core_uptime, core_uptime_doc, 0 }, {"core.ps", core_ps, core_ps_doc, RET_ARRAY}, {"core.psx", core_psx, core_psx_doc, RET_ARRAY}, + {"core.psa", core_psa, core_psa_doc, RET_ARRAY}, {"core.pwd", core_pwd, core_pwd_doc, RET_ARRAY}, {"core.arg", core_arg, core_arg_doc, RET_ARRAY}, {"core.kill", core_kill, core_kill_doc, 0 },
5 years, 11 months
1
0
0
0
git:master:97af78a5: core: added function to detect when processes were initialized
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 97af78a5c4dd2b99da5d2f7048ac6fa73db94c1d URL:
https://github.com/kamailio/kamailio/commit/97af78a5c4dd2b99da5d2f7048ac6fa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-12-28T09:56:26+01:00 core: added function to detect when processes were initialized - sr_instance_ready() return 1 if all processes finished child_init() --- Modified: src/core/pt.c Modified: src/core/pt.h Modified: src/core/sr_module.c Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/97af78a5c4dd2b99da5d2f7048ac6fa…
Patch:
https://github.com/kamailio/kamailio/commit/97af78a5c4dd2b99da5d2f7048ac6fa…
5 years, 11 months
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
32
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Results per page:
10
25
50
100
200