Module: kamailio
Branch: 5.4
Commit: 4584e17b98f338916cc89dac6e1700f250cdf501
URL:
https://github.com/kamailio/kamailio/commit/4584e17b98f338916cc89dac6e1700f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-07-16T17:31:06+02:00
dispatcher: update state if sending keepalive OPTIONS fails
- it can be due to DNS resolving failure, therefore needs to be counted
for making it inactive, otherwise keeps failing and writting errors
(cherry picked from commit 6c77c86ab8fdec51293f0d850b9b9771d6266816)
---
Modified: src/modules/dispatcher/dispatch.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4584e17b98f338916cc89dac6e1700f…
Patch:
https://github.com/kamailio/kamailio/commit/4584e17b98f338916cc89dac6e1700f…
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 9903ae0eb8..b78a89fdb5 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -3365,6 +3365,8 @@ void ds_ping_set(ds_set_t *node)
int i, j;
str ping_from;
str obproxy;
+ int state;
+ ds_rctx_t rctx;
if(!node)
return;
@@ -3427,8 +3429,25 @@ void ds_ping_set(ds_set_t *node)
if(tmb.t_request(&uac_r, &node->dlist[j].uri, &node->dlist[j].uri,
&ping_from, &obproxy)
< 0) {
- LM_ERR("unable to ping [%.*s]\n", node->dlist[j].uri.len,
- node->dlist[j].uri.s);
+ LM_ERR("unable to ping [%.*s] in group [%d]\n",
+ node->dlist[j].uri.len, node->dlist[j].uri.s,
+ node->id);
+ state = DS_TRYING_DST;
+ if(ds_probing_mode != DS_PROBE_NONE) {
+ state |= DS_PROBING_DST;
+ }
+ memset(&rctx, 0, sizeof(ds_rctx_t));
+ rctx.code = 500;
+ rctx.reason.s = "Sending keepalive failed";
+ rctx.reason.len = 24;
+ /* check if meantime someone disabled the target via RPC */
+ if(!(node->dlist[j].flags & DS_DISABLED_DST)
+ && ds_update_state(NULL, node->id, &node->dlist[j].uri,
+ state, &rctx) != 0) {
+ LM_ERR("Setting the probing state failed (%.*s, group %d)\n",
+ node->dlist[j].uri.len, node->dlist[j].uri.s,
+ node->id);
+ }
}
}
}