Browse code

registrar: restructured condition for clarity

Daniel-Constantin Mierla authored on 28/07/2017 08:29:33
Showing 2 changed files
... ...
@@ -277,10 +277,15 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
277 277
 			return -1;
278 278
 		}
279 279
 		aor = *ptr->aor;
280
-		/* test if un-expired and suported contact */
281
-		if( (ptr) && !(VALID_CONTACT(ptr,act_time)
282
-					&& (ret=-2) && allowed_method(_m,ptr)))
283
-			goto done;
280
+		/* test if not expired and contact with suported method */
281
+		if(ptr) {
282
+			if(!(VALID_CONTACT(ptr,act_time))) {
283
+				goto done;
284
+			} else if(!allowed_method(_m,ptr)) {
285
+				ret=-2;
286
+				goto done;
287
+			}
288
+		}
284 289
 		LM_DBG("contact for [%.*s] found by temp gruu [%.*s / %u]\n",
285 290
 							aor.len, ZSW(aor.s), inst.len, inst.s, ahash);
286 291
 	}
... ...
@@ -538,6 +538,7 @@ int pv_fetch_contacts_helper(sip_msg_t* msg, udomain_t* dt, str* uri,
538 538
 			c0->instance.len = ptr->instance.len;
539 539
 			p += c0->instance.len;
540 540
 		}
541
+		LM_DBG("memory block between %p - %p\n", c0, p);
541 542
 		if ((ptr->sock) && (ptr->sock->proto == PROTO_TCP
542 543
 				|| ptr->sock->proto == PROTO_TLS || ptr->sock->proto == PROTO_WS
543 544
 				|| ptr->sock->proto == PROTO_WSS))