rem: DBG("DEBUG: reply sent out. buf=%p: %.9s..., shmem=%p: %.9s\n", buf, buf, rb->buffer, rb->buffer );
add: DBG("DEBUG:tm:_reply_light: reply sent out. buf=%p: %.9s..., " "shmem=%p: %.9s\n", buf, buf, rb->buffer, rb->buffer );
context: static int _reply_light( struct cell *trans, char* buf, unsigned int len,			 unsigned int code, char * text, 			 char *to_tag, unsigned int to_tag_len, int lock,			 struct bookmark *bm	){	struct retr_buf *rb;	unsigned int buf_len;	branch_bm_t cancel_bitmap;	if (!buf)	{		DBG("DEBUG: _reply_light: response building failed\n");		/* determine if there are some branches to be canceled */		if ( is_invite(trans) ) {			if (lock) LOCK_REPLIES( trans );			which_cancel(trans, &cancel_bitmap );			if (lock) UNLOCK_REPLIES( trans );		}		/* and clean-up, including cancellations, if needed */		goto error;	}	cancel_bitmap=0;	if (lock) LOCK_REPLIES( trans );	if ( is_invite(trans) ) which_cancel(trans, &cancel_bitmap );	if (trans->uas.status>=200) {		LOG( L_ERR, "ERROR: _reply_light: can't generate %d reply"			" when a final %d was sent out\n", code, trans->uas.status);		goto error2;	}	rb = & trans->uas.response;	rb->activ_type=code;	trans->uas.status = code;	buf_len = rb->buffer ? len : len + REPLY_OVERBUFFER_LEN;	rb->buffer = (char*)shm_resize( rb->buffer, buf_len );	/* puts the reply's buffer to uas.response */	if (! rb->buffer ) {			LOG(L_ERR, "ERROR: _reply_light: cannot allocate shmem buffer\n");			goto error3;	}	update_local_tags(trans, bm, rb->buffer, buf);	rb->buffer_len = len ;	memcpy( rb->buffer , buf , len );	/* needs to be protected too because what timers are set depends	   on current transactions status */	/* t_update_timers_after_sending_reply( rb ); */	update_reply_stats( code );	trans->relaied_reply_branch=-2;	tm_stats->replied_localy++;	if (lock) UNLOCK_REPLIES( trans );		/* do UAC cleanup procedures in case we generated	   a final answer whereas there are pending UACs */	if (code>=200) {		if ( is_local(trans) ) {			DBG("DEBUG: local transaction completed from _reply\n");			if ( has_tran_tmcbs(trans, TMCB_LOCAL_COMPLETED) )				run_trans_callbacks( TMCB_LOCAL_COMPLETED, trans,					0, FAKED_REPLY, code);		} else {			if ( has_tran_tmcbs(trans, TMCB_RESPONSE_OUT) )				run_trans_callbacks( TMCB_RESPONSE_OUT, trans,					trans->uas.request, FAKED_REPLY, code);		}		cleanup_uac_timers( trans );		if (is_invite(trans)) cancel_uacs( trans, cancel_bitmap );		set_final_timer(  trans );	}	/* send it out */	/* first check if we managed to resolve topmost Via -- if	   not yet, don't try to retransmit	*/	/*	   response.dst.send_sock is valid all the time now, as it's taken	   from original request -bogdan	if (!trans->uas.response.dst.send_sock) {		LOG(L_ERR, "ERROR: _reply_light: no resolved dst to send reply to\n");	} else {	*/	assert(trans->uas.response.dst.send_sock);	SEND_PR_BUFFER( rb, buf, len );	DBG("DEBUG: reply sent out. buf=%p: %.9s..., shmem=%p: %.9s\n", 		buf, buf, rb->buffer, rb->buffer );	pkg_free( buf ) ;	DBG("DEBUG: _reply_light: finished\n");	return 1;error3:error2:	if (lock) UNLOCK_REPLIES( trans );	pkg_free ( buf );error:	/* do UAC cleanup */	cleanup_uac_timers( trans );	if ( is_invite(trans) ) cancel_uacs( trans, cancel_bitmap );	/* we did not succeed -- put the transaction on wait */	put_on_wait(trans);	return -1;}