rem: int lret, my_err;
add: int lret, my_err, ret;
context: int t_newtran( struct sip_msg* p_msg ){	int lret, my_err;	ret=1;	/* is T still up-to-date ? */	DBG("DEBUG: t_addifnew: msg id=%d , global msg id=%d ,"		" T on entrance=%p\n",p_msg->id,global_msg_id,T);	if ( T && T!=T_UNDEFINED  ) {		LOG(L_ERR, "ERROR: t_newtran: "			"transaction already in process %p\n", T );		return E_SCRIPT;	}	global_msg_id = p_msg->id;	T = T_UNDEFINED;	/* first of all, parse everything -- we will store in shared memory 	   and need to have all headers ready for generating potential replies 	   later; parsing later on demand is not an option since the request 	   will be in shmem and applying parse_headers to it would intermix 	   shmem with pkg_mem	*/		if (parse_headers(p_msg, HDR_EOH, 0 )) {		LOG(L_ERR, "ERROR: t_newtran: parse_headers failed\n");		return E_BAD_REQ;	}	if ((p_msg->parsed_flag & HDR_EOH)!=HDR_EOH) {			LOG(L_ERR, "ERROR: t_newtran: EoH not parsed\n");			return E_OUT_OF_MEM;	}	/* t_lookup_requests attmpts to find the transaction; 	   it also calls check_transaction_quadruple -> it is	   safe to assume we have from/callid/cseq/to	*/ 	lret = t_lookup_request( p_msg, 1 /* leave locked if not found */ );	/* on error, pass the error in the stack ... nothing is locked yet	   if 0 is returned */	if (lret==0) return E_BAD_TUPEL;	/* transaction found, it's a retransmission  */	if (lret>0) {		if (p_msg->REQ_METHOD==METHOD_ACK) {			t_release_transaction(T);		} else {			t_retransmit_reply(T);		}		/* things are done -- return from script */		return 0;	}	/* from now on, be careful -- hash table is locked */	if (lret==-2) { /* was it an e2e ACK ? if so, trigger a callback */		/* no callbacks? complete quickly */		if (!callback_array[TMCB_E2EACK_IN]) {			UNLOCK_HASH(p_msg->hash_index);			return 1;		} 		REF_UNSAFE(t_ack);		UNLOCK_HASH(p_msg->hash_index);		/* we don't call from within REPLY_LOCK -- that introduces	   	   a race condition; however, it is so unlikely and the	   	   impact is so small (callback called multiple times of           multiple ACK/200s received in parallel), that we do not	   	    better waste time in locks		 */		if (unmatched_totag(t_ack, p_msg)) {			callback_event( TMCB_E2EACK_IN, t_ack, p_msg, 				p_msg->REQ_METHOD );		}		UNREF(t_ack);		return 1;	} 	/* transaction not found, it's a new request (lret<0, lret!=-2);	   establish a new transaction ... */	if (p_msg->REQ_METHOD==METHOD_ACK) { /* ... unless it is in ACK */		my_err=1;		goto new_err;	}	my_err=new_t(p_msg);	if (my_err<0) {		LOG(L_ERR, "ERROR: t_newtran: new_t failed\n");		goto new_err;	}	UNLOCK_HASH(p_msg->hash_index);	/* now, when the transaction state exists, check if 	   there is a meaningful Via and calculate it; better 	   do it now than later: state is established so that 	   subsequent retransmissions will be absorbed and will  	  not possibly block during Via DNS resolution; doing	   it later would only burn more CPU as if there is an	   error, we cannot relay later whatever comes out of the  	   the transaction 	*/	if (!init_rb( &T->uas.response, p_msg)) {		LOG(L_ERR, "ERROR: t_newtran: unresolveable via1\n");		put_on_wait( T );		t_unref(p_msg);		return E_BAD_VIA;	}	return 1;new_err:	UNLOCK_HASH(p_msg->hash_index);	return my_err;}