Skip to content

Commit

Permalink
rtpengine: optional ping parameter for rpc reload command
Browse files Browse the repository at this point in the history
- specify if ping should be done to rtpengines at reload time
  • Loading branch information
miconda committed Feb 1, 2024
1 parent df3d1e5 commit 40b7352
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/rtpengine/rtpengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,8 @@ static int rtpp_test_ping(struct rtpp_node *node)
static void rtpengine_rpc_reload(rpc_t *rpc, void *ctx)
{
time_t tnow;
int rping = 1;
int n = 0;

if(rtpp_db_url.s == NULL) {
// no database
Expand All @@ -1621,6 +1623,13 @@ static void rtpengine_rpc_reload(rpc_t *rpc, void *ctx)
return;
}

n = rpc->scan(ctx, "*d", &rping);
if(n != 1) {
rping = 1;
} else if(rping != 0) {
rping = 1;
}

tnow = time(NULL);
if(tnow - _rtpe_list_version->vertime < RTPE_LIST_VERSION_DELAY) {
rpc->fault(ctx, 500, "Too short reload interval - try later");
Expand All @@ -1634,7 +1643,7 @@ static void rtpengine_rpc_reload(rpc_t *rpc, void *ctx)
return;
}

if(build_rtpp_socks(1, 1)) {
if(build_rtpp_socks(1, rping)) {
rpc->fault(ctx, 500, "Failed to build rtpengine sockets");
return;
}
Expand Down

0 comments on commit 40b7352

Please sign in to comment.