rem: if (p_cell) goto found; else goto notfound;
add: if (p_cell) {  if (isACK && p_cell->uas.status>=200 && p_cell->uas.status<300) { "considered mismatch\n", p_cell );  t_ack=p_cell; ret=-2; goto notfound; }  goto found; }  goto notfound;
context: int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked ){	struct cell         *p_cell;	unsigned int       isACK;	struct sip_msg  *t_msg;	int ret;	struct via_param *branch;	/* parse all*/	if (check_transaction_quadruple(p_msg)==0)	{		LOG(L_ERR, "ERROR: TM module: t_lookup_request: too few headers\n");		set_t(0);			/* stop processing */		return 0;	}	/* start searching into the table */	if (!p_msg->hash_index)		p_msg->hash_index=hash( p_msg->callid->body , 			get_cseq(p_msg)->number ) ;	isACK = p_msg->REQ_METHOD==METHOD_ACK;	DBG("t_lookup_request: start searching: hash=%d, isACK=%d\n",		p_msg->hash_index,isACK);	/* asume not found */	ret=-1;	/* first of all, look if there is RFC3261 magic cookie in branch; if	 * so, we can do very quick matching and skip the old-RFC bizzar	 * comparison of many header fields	 */	if (!p_msg->via1) {		LOG(L_ERR, "ERROR: t_lookup_request: no via\n");		set_t(0);			return 0;	}	branch=p_msg->via1->branch;	if (branch && branch->value.s && branch->value.len>MCOOKIE_LEN			&& memcmp(branch->value.s,MCOOKIE,MCOOKIE_LEN)==0) {		/* huhuhu! the cookie is there -- let's proceed fast */		LOCK_HASH(p_msg->hash_index);		p_cell=tid_matching(p_msg->hash_index, p_msg->via1, 				/* skip transactions with different				 * method; otherwise CANCEL would 				 * match the previous INVITE trans.				 */				isACK ? ~METHOD_INVITE: ~p_msg->REQ_METHOD);		if (p_cell) goto found; else goto notfound;	}	/* ok -- it's ugly old-fashioned transaction matching */	DBG("DEBUG: proceeding to pre-RFC3261 transaction matching\n");	/* lock the whole entry*/	LOCK_HASH(p_msg->hash_index);	/* all the transactions from the entry are compared */	for ( p_cell = get_tm_table()->entrys[p_msg->hash_index].first_cell;		  p_cell; p_cell = p_cell->next_cell ) 	{		t_msg = p_cell->uas.request;		if (!isACK) {				/* compare lengths first */ 			if (!EQ_LEN(callid)) continue;			if (!EQ_LEN(cseq)) continue;			if (!EQ_LEN(from)) continue;			if (!EQ_LEN(to)) continue;			if (ruri_matching && !EQ_REQ_URI_LEN) continue;			if (!EQ_VIA_LEN(via1)) continue;			/* length ok -- move on */			if (!EQ_STR(callid)) continue;			if (!EQ_STR(cseq)) continue;			if (!EQ_STR(from)) continue;			if (!EQ_STR(to)) continue;			if (ruri_matching && !EQ_REQ_URI_STR) continue;			if (!EQ_VIA_STR(via1)) continue;			/* request matched ! */			DBG("DEBUG: non-ACK matched\n");			goto found;		} else { /* it's an ACK request*/			/* ACK's relate only to INVITEs */			if (t_msg->REQ_METHOD!=METHOD_INVITE) continue;			/* compare lengths now */			if (!EQ_LEN(callid)) continue;			/* CSeq only the number without method ! */			if (get_cseq(t_msg)->number.len!=get_cseq(p_msg)->number.len)				continue;			if (! EQ_LEN(from)) continue;			/* To only the uri and ... */			if (get_to(t_msg)->uri.len!=get_to(p_msg)->uri.len)				continue;			/* don't care about to-tags -- many UAC screw them			 * up anyway, and it doesn't hurt if we ignore 			 * them */#ifdef ACKTAG			/* ... its to-tag compared to reply's tag */			if (p_cell->uas.to_tag.len!=get_to(p_msg)->tag_value.len)				continue;#endif			/* we first skip r-uri and Via and proceed with			   content of other header-fields */			if ( memcmp(t_msg->callid->body.s, p_msg->callid->body.s,				p_msg->callid->body.len)!=0) continue;			if ( memcmp(get_cseq(t_msg)->number.s, get_cseq(p_msg)->number.s,				get_cseq(p_msg)->number.len)!=0) continue;			if (!EQ_STR(from)) continue;			if (memcmp(get_to(t_msg)->uri.s, get_to(p_msg)->uri.s,				get_to(t_msg)->uri.len)!=0) continue;#ifdef ACKTAG			if (#ifdef _BUG				p_cell->uas.to_tag.len!=0 /* to-tags empty */ || #endif				memcmp(p_cell->uas.to_tag.s, get_to(p_msg)->tag_value.s,				p_cell->uas.to_tag.len)!=0) continue;#endif				/* ok, now only r-uri or via can mismatch; they must match			   for non-2xx; if it is a 2xx, we don't try to match			   (we might have checked that earlier to speed-up, but			   we still want to see a diagnosti message telling			   "this ACK presumably belongs to this 2xx transaction";			   might change in future); the reason is 2xx ACKs are			   a separate transaction which may carry different			   r-uri/via1 and is thus also impossible to match it			   uniquely to a spiraled transaction;			*/			if (p_cell->uas.status>=200 && p_cell->uas.status<300) {				DBG("DEBUG: an ACK hit a 2xx transaction (T=%p); "					"considered mismatch\n", p_cell );				/* perhaps there are some spirals on the synonym list, but				   it makes no sense to iterate the list until bitter end */				t_ack=p_cell;				ret=-2;				break;			}			/* its for a >= 300 ... everything must match ! */			if (ruri_matching && ! EQ_REQ_URI_LEN ) continue;			if (! EQ_VIA_LEN(via1)) continue;			if (ruri_matching && !EQ_REQ_URI_STR) continue;			if (!EQ_VIA_STR(via1)) continue;			/* wow -- we survived all the check! we matched! */			DBG("DEBUG: non-2xx ACK matched\n");			goto found;		} /* ACK */	} /* synonym loop */notfound:	/* no transaction found */	set_t(0);	if (!leave_new_locked) {		UNLOCK_HASH(p_msg->hash_index);	}	DBG("DEBUG: t_lookup_request: no transaction found\n");	return ret;found:	set_t(p_cell);	REF_UNSAFE( T );	T->kr|=REQ_EXIST;	UNLOCK_HASH( p_msg->hash_index );	DBG("DEBUG: t_lookup_request: transaction found (T=%p)\n",T);	return 1;}