Module: kamailio
Branch: master
Commit: 6c77c86ab8fdec51293f0d850b9b9771d6266816
URL: 
https://github.com/kamailio/kamailio/commit/6c77c86ab8fdec51293f0d850b9b9771d6266816

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2020-07-15T18:02:16+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

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/6c77c86ab8fdec51293f0d850b9b9771d6266816.diff
Patch: 
https://github.com/kamailio/kamailio/commit/6c77c86ab8fdec51293f0d850b9b9771d6266816.patch

---

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);
+                               }
                        }
                }
        }


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to