[sr-dev] git:master:7a66f445: dispatcher: Stop searching if entry is found

Henning Westerholt henningw at users.noreply.github.com
Tue Feb 5 21:11:09 CET 2019


Module: kamailio
Branch: master
Commit: 7a66f44506e4897fef68b5ff927cf276678d3473
URL: https://github.com/kamailio/kamailio/commit/7a66f44506e4897fef68b5ff927cf276678d3473

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <henningw at users.noreply.github.com>
Date: 2019-02-05T21:11:03+01:00

dispatcher: Stop searching if entry is found

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7a66f44506e4897fef68b5ff927cf276678d3473.diff
Patch: https://github.com/kamailio/kamailio/commit/7a66f44506e4897fef68b5ff927cf276678d3473.patch

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 072869010e..727dbe0cc0 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2590,7 +2590,6 @@ int ds_update_latency(int group, str *address, int code)
 int ds_get_state(int group, str *address)
 {
 	int i = 0;
-	int state = 0;
 	ds_set_t *idx = NULL;
 
 	if(_ds_list == NULL || _ds_list_nr <= 0) {
@@ -2609,11 +2608,11 @@ int ds_get_state(int group, str *address)
 				&& strncasecmp(idx->dlist[i].uri.s, address->s, address->len)
 						   == 0) {
 			/* destination address found */
-			state = idx->dlist[i].flags;
+			return idx->dlist[i].flags;
 		}
 		i++;
 	}
-	return state;
+	return 0;
 }
 
 /**




More information about the sr-dev mailing list