[sr-dev] git:5.1:f23f1a86: dispatcher: Stop searching if entry is found

Henning Westerholt hw at kamailio.org
Tue Feb 5 21:29:08 CET 2019


Module: kamailio
Branch: 5.1
Commit: f23f1a86064c82a717d5920f41c17aad1e76b026
URL: https://github.com/kamailio/kamailio/commit/f23f1a86064c82a717d5920f41c17aad1e76b026

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-05T21:26:11+01:00

dispatcher: Stop searching if entry is found

(cherry picked from commit 7a66f44506e4897fef68b5ff927cf276678d3473)

---

Modified: src/modules/dispatcher/dispatch.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index e40d02e974..7e246e577d 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2362,7 +2362,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) {
@@ -2381,11 +2380,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