瀏覽代碼

- TM retransmissions disabled for all but UDP
- kr set through a function now

Jiri Kuthan 22 年之前
父節點
當前提交
c0899aa1bf
共有 6 個文件被更改,包括 44 次插入25 次删除
  1. 23 0
      modules/tm/h_table.h
  2. 6 14
      modules/tm/t_funcs.c
  3. 3 2
      modules/tm/t_fwd.c
  4. 4 3
      modules/tm/t_lookup.c
  5. 6 5
      modules/tm/t_reply.c
  6. 2 1
      modules/tm/uac.c

+ 23 - 0
modules/tm/h_table.h

@@ -23,6 +23,10 @@
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * History:
+ * --------
+ * 2003-03-01  kr set through a function now (jiri)
  */
 
 #include "defs.h"
@@ -71,6 +75,17 @@ void unlock_hash(int i);
    flags is set and script is being left, it is a sign of
    script error and we need to release on writer's
    behalf
+
+   REQ_FWDED means there is a UAC with final response timer
+             ticking. If it hits, transaction will be completed.
+   REQ_RPLD means that a transaction has been replied -- either
+            it implies going to wait state, or for invite transactions
+            FR timer is ticking until ACK arrives
+   REQ_RLSD means that a transaction was put on wait explicitely
+            from t_release_transaction
+   REQ_EXIST means that this request is a retransmission which does not
+            affect transactional state
+         
 */
 enum kill_reason { REQ_FWDED=1, REQ_RPLD=2, REQ_RLSD=4, REQ_EXIST=8 };
 
@@ -251,6 +266,14 @@ struct s_table
 	struct entry   entrys[ TABLE_ENTRIES ];
 };
 
+inline static void set_kr( struct cell *t, enum kill_reason kr )
+{
+	if (t->kr!=0) {
+		LOG(L_ERR, "ERROR: set_kr: kill_reason reset: from=%d to=%d\n",
+		t->kr, kr);
+	}
+	t->kr|=kr;
+}
 
 struct s_table* get_tm_table();
 struct s_table* init_hash_table();

+ 6 - 14
modules/tm/t_funcs.c

@@ -29,6 +29,7 @@
 /*
  * History:
  * -------
+ *  2003-03-01  start_retr changed to retransmit only for UDP
  *  2003-02-13  modified send_pr_buffer to use msg_send & rb->dst (andrei)
  */
 
@@ -67,8 +68,10 @@ int send_pr_buffer( struct retr_buf *rb,
 
 void start_retr( struct retr_buf *rb )
 {
-	rb->retr_list=RT_T1_TO_1;
-	set_timer( &rb->retr_timer, RT_T1_TO_1 );
+	if (rb->dst.proto==PROTO_UDP) {
+		rb->retr_list=RT_T1_TO_1;
+		set_timer( &rb->retr_timer, RT_T1_TO_1 );
+	}
 	set_timer( &rb->fr_timer, FR_TIMER_LIST );
 }
 
@@ -98,7 +101,7 @@ void tm_shutdown()
 */
 int t_release_transaction( struct cell *trans )
 {
-	trans->kr|=REQ_RLSD;
+	set_kr(trans,REQ_RLSD);
 
 	reset_timer( & trans->uas.response.fr_timer );
 	reset_timer( & trans->uas.response.retr_timer );
@@ -118,17 +121,6 @@ int t_release_transaction( struct cell *trans )
 void put_on_wait(  struct cell  *Trans  )
 {
 
-#ifdef _XWAIT
-	LOCK_WAIT(Trans);
-	if (Trans->on_wait)
-	{
-		DBG("DEBUG: t_put_on_wait: already on wait\n");
-		UNLOCK_WAIT(Trans);
-	} else {
-		Trans->on_wait=1;
-		UNLOCK_WAIT(Trans);
-	}
-#endif
 #ifdef EXTRA_DEBUG
 	DBG("DEBUG: put on WAIT \n");
 #endif

+ 3 - 2
modules/tm/t_fwd.c

@@ -28,9 +28,10 @@
 /*
  * History:
  * -------
- *  2003-02-13  proto support added (andrei)
+ *  2003-03-01  kr set through a function now (jiri)
  *  2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
  *              nameser_compat.h (andrei)
+ *  2003-02-13  proto support added (andrei)
  */
 
 #include "defs.h"
@@ -342,7 +343,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 	/* make -Wall happy */
 	current_uri.s=0;
 
-	t->kr|=REQ_FWDED;
+	set_kr(t, REQ_FWDED);
 
 	if (p_msg->REQ_METHOD==METHOD_CANCEL) {
 		t_invite=t_lookupOriginalT(  p_msg );

+ 4 - 3
modules/tm/t_lookup.c

@@ -51,13 +51,14 @@
  *
  * History:
  * ----------
+ * 2003-03-01  kr set through a function now (jiri)
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-27  3261 ACK/200 consumption bug removed (jiri)
+ * 2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
+ * 2003-02-13  init_rb() is proto indep. & it uses struct dest_info (andrei)
  * 2003-01-28  scratchpad removed (jiri)
  * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
  * 2003-01-23  options for disabling r-uri matching introduced (jiri)
- * 2003-02-13  init_rb() is proto indep. & it uses struct dest_info (andrei)
- * 2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
  *              nameser_compat.h (andrei)
  */
 
@@ -382,7 +383,7 @@ notfound:
 found:
 	set_t(p_cell);
 	REF_UNSAFE( T );
-	T->kr|=REQ_EXIST;
+	set_kr(T, REQ_EXIST);
 	UNLOCK_HASH( p_msg->hash_index );
 	DBG("DEBUG: t_lookup_request: transaction found (T=%p)\n",T);
 	return 1;

+ 6 - 5
modules/tm/t_reply.c

@@ -27,12 +27,13 @@
  *
  * History:
  * --------
+ * 2003-03-01  kr set through a function now (jiri)
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
- * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
- * 2003-01-19  faked lump list created in on_reply handlers
- * 2003-02-13  updated to use rb->dst (andrei)
  * 2003-02-18  replaced TOTAG_LEN w/ TOTAG_VALUE_LEN (TOTAG_LEN was defined
  *             twice with different values!)  (andrei)
+ * 2003-02-13  updated to use rb->dst (andrei)
+ * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
+ * 2003-01-19  faked lump list created in on_reply handlers
  */
 
 #include "defs.h"
@@ -501,7 +502,7 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
 	char * buf;
 #endif
 
-	if (code>=200) trans->kr|=REQ_RPLD;
+	if (code>=200) set_kr(trans,REQ_RPLD);
 	/*
 	buf = build_res_buf_from_sip_req(code,text,trans->uas.tag->s,
 		trans->uas.tag->len, trans->uas.request,&len);
@@ -1069,7 +1070,7 @@ int t_reply_with_body( struct sip_msg* p_msg, unsigned int code, char * text, ch
 	s_to_tag.len = strlen(to_tag);
 
     // mark the transaction as replied
-    t->kr|=REQ_RPLD;
+    set_kr(t,REQ_RPLD);
 
     /* compute the response */
     sb.s = body;

+ 2 - 1
modules/tm/uac.c

@@ -44,6 +44,7 @@
  *
  * History:
  * --------
+ * 2003-03-01  kr set through a function now (jiri)
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-27 FIFO/UAC now dumps reply -- good for CTD (jiri)
  * 2003-02-13  t_uac, t _uac_dlg, gethfblock, uri2proxy changed to use 
@@ -359,7 +360,7 @@ int t_uac_dlg(str* msg,                     /* Type of the message - MESSAGE, OP
 
 	new_cell->is_invite = msg->len == INVITE_LEN && memcmp(msg->s, INVITE, INVITE_LEN) == 0;
 	new_cell->local= 1 ;
-	new_cell->kr = REQ_FWDED;
+	set_kr(new_cell, REQ_FWDED);
 
 	request = &new_cell->uac[branch].request;
 	request->dst.to = to_su;