[sr-dev] git:master:5ef8d7a9: registrar: restructured condition for clarity

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 28 10:30:44 CEST 2017


Module: kamailio
Branch: master
Commit: 5ef8d7a9f8e1120ea245084d91c00c64e836f97a
URL: https://github.com/kamailio/kamailio/commit/5ef8d7a9f8e1120ea245084d91c00c64e836f97a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-28T10:30:19+02:00

registrar: restructured condition for clarity

---

Modified: src/modules/registrar/lookup.c
Modified: src/modules/registrar/regpv.c

---

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

---

diff --git a/src/modules/registrar/lookup.c b/src/modules/registrar/lookup.c
index 03be9482e5..b18fe993aa 100644
--- a/src/modules/registrar/lookup.c
+++ b/src/modules/registrar/lookup.c
@@ -277,10 +277,15 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
 			return -1;
 		}
 		aor = *ptr->aor;
-		/* test if un-expired and suported contact */
-		if( (ptr) && !(VALID_CONTACT(ptr,act_time)
-					&& (ret=-2) && allowed_method(_m,ptr)))
-			goto done;
+		/* test if not expired and contact with suported method */
+		if(ptr) {
+			if(!(VALID_CONTACT(ptr,act_time))) {
+				goto done;
+			} else if(!allowed_method(_m,ptr)) {
+				ret=-2;
+				goto done;
+			}
+		}
 		LM_DBG("contact for [%.*s] found by temp gruu [%.*s / %u]\n",
 							aor.len, ZSW(aor.s), inst.len, inst.s, ahash);
 	}
diff --git a/src/modules/registrar/regpv.c b/src/modules/registrar/regpv.c
index ad82262a04..e90625cdc4 100644
--- a/src/modules/registrar/regpv.c
+++ b/src/modules/registrar/regpv.c
@@ -538,6 +538,7 @@ int pv_fetch_contacts_helper(sip_msg_t* msg, udomain_t* dt, str* uri,
 			c0->instance.len = ptr->instance.len;
 			p += c0->instance.len;
 		}
+		LM_DBG("memory block between %p - %p\n", c0, p);
 		if ((ptr->sock) && (ptr->sock->proto == PROTO_TCP
 				|| ptr->sock->proto == PROTO_TLS || ptr->sock->proto == PROTO_WS
 				|| ptr->sock->proto == PROTO_WSS))




More information about the sr-dev mailing list