Browse code

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

Jiri Kuthan authored on 01/03/2003 23:09:34
Showing 6 changed files
... ...
@@ -23,6 +23,10 @@
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ *
27
+ * History:
28
+ * --------
29
+ * 2003-03-01  kr set through a function now (jiri)
26 30
  */
27 31
 
28 32
 #include "defs.h"
... ...
@@ -71,6 +75,17 @@ void unlock_hash(int i);
71 75
    flags is set and script is being left, it is a sign of
72 76
    script error and we need to release on writer's
73 77
    behalf
78
+
79
+   REQ_FWDED means there is a UAC with final response timer
80
+             ticking. If it hits, transaction will be completed.
81
+   REQ_RPLD means that a transaction has been replied -- either
82
+            it implies going to wait state, or for invite transactions
83
+            FR timer is ticking until ACK arrives
84
+   REQ_RLSD means that a transaction was put on wait explicitely
85
+            from t_release_transaction
86
+   REQ_EXIST means that this request is a retransmission which does not
87
+            affect transactional state
88
+         
74 89
 */
75 90
 enum kill_reason { REQ_FWDED=1, REQ_RPLD=2, REQ_RLSD=4, REQ_EXIST=8 };
76 91
 
... ...
@@ -251,6 +266,14 @@ struct s_table
251 266
 	struct entry   entrys[ TABLE_ENTRIES ];
252 267
 };
253 268
 
269
+inline static void set_kr( struct cell *t, enum kill_reason kr )
270
+{
271
+	if (t->kr!=0) {
272
+		LOG(L_ERR, "ERROR: set_kr: kill_reason reset: from=%d to=%d\n",
273
+		t->kr, kr);
274
+	}
275
+	t->kr|=kr;
276
+}
254 277
 
255 278
 struct s_table* get_tm_table();
256 279
 struct s_table* init_hash_table();
... ...
@@ -29,6 +29,7 @@
29 29
 /*
30 30
  * History:
31 31
  * -------
32
+ *  2003-03-01  start_retr changed to retransmit only for UDP
32 33
  *  2003-02-13  modified send_pr_buffer to use msg_send & rb->dst (andrei)
33 34
  */
34 35
 
... ...
@@ -67,8 +68,10 @@ int send_pr_buffer( struct retr_buf *rb,
67 68
 
68 69
 void start_retr( struct retr_buf *rb )
69 70
 {
70
-	rb->retr_list=RT_T1_TO_1;
71
-	set_timer( &rb->retr_timer, RT_T1_TO_1 );
71
+	if (rb->dst.proto==PROTO_UDP) {
72
+		rb->retr_list=RT_T1_TO_1;
73
+		set_timer( &rb->retr_timer, RT_T1_TO_1 );
74
+	}
72 75
 	set_timer( &rb->fr_timer, FR_TIMER_LIST );
73 76
 }
74 77
 
... ...
@@ -98,7 +101,7 @@ void tm_shutdown()
98 101
 */
99 102
 int t_release_transaction( struct cell *trans )
100 103
 {
101
-	trans->kr|=REQ_RLSD;
104
+	set_kr(trans,REQ_RLSD);
102 105
 
103 106
 	reset_timer( & trans->uas.response.fr_timer );
104 107
 	reset_timer( & trans->uas.response.retr_timer );
... ...
@@ -118,17 +121,6 @@ int t_release_transaction( struct cell *trans )
118 121
 void put_on_wait(  struct cell  *Trans  )
119 122
 {
120 123
 
121
-#ifdef _XWAIT
122
-	LOCK_WAIT(Trans);
123
-	if (Trans->on_wait)
124
-	{
125
-		DBG("DEBUG: t_put_on_wait: already on wait\n");
126
-		UNLOCK_WAIT(Trans);
127
-	} else {
128
-		Trans->on_wait=1;
129
-		UNLOCK_WAIT(Trans);
130
-	}
131
-#endif
132 124
 #ifdef EXTRA_DEBUG
133 125
 	DBG("DEBUG: put on WAIT \n");
134 126
 #endif
... ...
@@ -28,9 +28,10 @@
28 28
 /*
29 29
  * History:
30 30
  * -------
31
- *  2003-02-13  proto support added (andrei)
31
+ *  2003-03-01  kr set through a function now (jiri)
32 32
  *  2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
33 33
  *              nameser_compat.h (andrei)
34
+ *  2003-02-13  proto support added (andrei)
34 35
  */
35 36
 
36 37
 #include "defs.h"
... ...
@@ -342,7 +343,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
342 343
 	/* make -Wall happy */
343 344
 	current_uri.s=0;
344 345
 
345
-	t->kr|=REQ_FWDED;
346
+	set_kr(t, REQ_FWDED);
346 347
 
347 348
 	if (p_msg->REQ_METHOD==METHOD_CANCEL) {
348 349
 		t_invite=t_lookupOriginalT(  p_msg );
... ...
@@ -51,13 +51,14 @@
51 51
  *
52 52
  * History:
53 53
  * ----------
54
+ * 2003-03-01  kr set through a function now (jiri)
54 55
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
55 56
  * 2003-02-27  3261 ACK/200 consumption bug removed (jiri)
57
+ * 2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
58
+ * 2003-02-13  init_rb() is proto indep. & it uses struct dest_info (andrei)
56 59
  * 2003-01-28  scratchpad removed (jiri)
57 60
  * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
58 61
  * 2003-01-23  options for disabling r-uri matching introduced (jiri)
59
- * 2003-02-13  init_rb() is proto indep. & it uses struct dest_info (andrei)
60
- * 2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
61 62
  *              nameser_compat.h (andrei)
62 63
  */
63 64
 
... ...
@@ -382,7 +383,7 @@ notfound:
382 383
 found:
383 384
 	set_t(p_cell);
384 385
 	REF_UNSAFE( T );
385
-	T->kr|=REQ_EXIST;
386
+	set_kr(T, REQ_EXIST);
386 387
 	UNLOCK_HASH( p_msg->hash_index );
387 388
 	DBG("DEBUG: t_lookup_request: transaction found (T=%p)\n",T);
388 389
 	return 1;
... ...
@@ -27,12 +27,13 @@
27 27
  *
28 28
  * History:
29 29
  * --------
30
+ * 2003-03-01  kr set through a function now (jiri)
30 31
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
31
- * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
32
- * 2003-01-19  faked lump list created in on_reply handlers
33
- * 2003-02-13  updated to use rb->dst (andrei)
34 32
  * 2003-02-18  replaced TOTAG_LEN w/ TOTAG_VALUE_LEN (TOTAG_LEN was defined
35 33
  *             twice with different values!)  (andrei)
34
+ * 2003-02-13  updated to use rb->dst (andrei)
35
+ * 2003-01-27  next baby-step to removing ZT - PRESERVE_ZT (jiri)
36
+ * 2003-01-19  faked lump list created in on_reply handlers
36 37
  */
37 38
 
38 39
 #include "defs.h"
... ...
@@ -501,7 +502,7 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
501 502
 	char * buf;
502 503
 #endif
503 504
 
504
-	if (code>=200) trans->kr|=REQ_RPLD;
505
+	if (code>=200) set_kr(trans,REQ_RPLD);
505 506
 	/*
506 507
 	buf = build_res_buf_from_sip_req(code,text,trans->uas.tag->s,
507 508
 		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
1069 1070
 	s_to_tag.len = strlen(to_tag);
1070 1071
 
1071 1072
     // mark the transaction as replied
1072
-    t->kr|=REQ_RPLD;
1073
+    set_kr(t,REQ_RPLD);
1073 1074
 
1074 1075
     /* compute the response */
1075 1076
     sb.s = body;
... ...
@@ -44,6 +44,7 @@
44 44
  *
45 45
  * History:
46 46
  * --------
47
+ * 2003-03-01  kr set through a function now (jiri)
47 48
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
48 49
  * 2003-02-27 FIFO/UAC now dumps reply -- good for CTD (jiri)
49 50
  * 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
359 360
 
360 361
 	new_cell->is_invite = msg->len == INVITE_LEN && memcmp(msg->s, INVITE, INVITE_LEN) == 0;
361 362
 	new_cell->local= 1 ;
362
-	new_cell->kr = REQ_FWDED;
363
+	set_kr(new_cell, REQ_FWDED);
363 364
 
364 365
 	request = &new_cell->uac[branch].request;
365 366
 	request->dst.to = to_su;