Browse code

*** empty log message ***

Bogdan-Andrei Iancu authored on 02/03/2002 04:51:55
Showing 14 changed files
... ...
@@ -79,9 +79,8 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
79 79
 	 -DDNS_IP_HACK  -DPKG_MALLOC \
80 80
 	 -DF_MALLOC  -DUSE_SYNONIM\
81 81
 	 -DSHM_MEM  -DSHM_MMAP \
82
-	 -DNO_DEBUG \
83 82
 	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
84
-	 -DWAIT -DNEW_HNAME # -DNOISY_REPLIES -DBOGDAN_TRIFLE \
83
+	 -DWAIT -DNEW_HNAME  -DNOISY_REPLIES -DBOGDAN_TRIFLE \
85 84
 	 #-DNO_DEBUG \
86 85
 	 #-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \
87 86
 	 #-DNOSMP \
... ...
@@ -172,6 +172,12 @@ inline static void* shm_malloc(unsigned int size)
172 172
 }
173 173
 
174 174
 
175
+#ifdef DBG_QM_MALLOC
176
+void* _shm_resize( void*, unsigned int, char*, char*, unsigned int);
177
+#else
178
+void* _shm_resize( void*, unsigned int);
179
+#endif
180
+
175 181
 
176 182
 #define shm_free_unsafe( _p ) MY_FREE(shm_block, (_p))
177 183
 
... ...
@@ -8,8 +8,7 @@
8 8
 #include "sh_malloc.h"
9 9
 #include "../../md5utils.h"
10 10
 
11
-/*   Frees the all the containes of a cell and the cell's body itself
12
-  */
11
+/* containes of a cell and the cell's body itself */
13 12
 void free_cell( struct cell* dead_cell )
14 13
 {
15 14
 	int i;
... ...
@@ -21,24 +20,24 @@ void free_cell( struct cell* dead_cell )
21 20
 	shm_lock();
22 21
 	if ( dead_cell->inbound_request )
23 22
 		sip_msg_free_unsafe( dead_cell->inbound_request );
24
-	if (b=dead_cell->outbound_response.retr_buffer)
23
+	if ((b=dead_cell->outbound_response.retr_buffer))
25 24
 		shm_free_unsafe( b );
26 25
 
27 26
 	/* UA Clients */
28 27
 	for ( i =0 ; i<dead_cell->nr_of_outgoings;  i++ )
29 28
 	{
30 29
 		/* outbound requests*/
31
-		if ( rb=dead_cell->outbound_request[i] )
30
+		if ( (rb=dead_cell->outbound_request[i]) )
32 31
 		{
33 32
 			if (rb->retr_buffer) shm_free_unsafe( rb->retr_buffer );
34 33
 			dead_cell->outbound_request[i] = NULL;
35 34
 			shm_free_unsafe( rb );
36 35
 		}
37 36
 		/* outbound ACKs, if any */
38
-		if (rb=dead_cell->outbound_ack[i] )
37
+		if ( (rb=dead_cell->outbound_ack[i]) )
39 38
 			shm_free_unsafe( rb );
40 39
 		/* local cancel , if any */
41
-		if (rb=dead_cell->outbound_cancel[i] )
40
+		if ( (rb=dead_cell->outbound_cancel[i]) )
42 41
 			shm_free_unsafe( rb );
43 42
 		/* inbound response */
44 43
 		if ( dead_cell -> inbound_response[i] )
... ...
@@ -93,7 +92,6 @@ void free_hash_table( struct s_table *hash_table )
93 92
 struct s_table* init_hash_table()
94 93
 {
95 94
    struct s_table*  hash_table;
96
-   pthread_t  thread;
97 95
    int       i;
98 96
 
99 97
    /*allocs the table*/
... ...
@@ -130,55 +128,54 @@ error:
130 128
 
131 129
 struct cell*  build_cell( struct sip_msg* p_msg )
132 130
 {
133
-   struct cell*  new_cell;
134
-   str                src[5];
135
-   int                i;
131
+	struct cell* new_cell;
132
+#ifndef USE_SYNONIM
133
+	str          src[5];
134
+#endif
136 135
 
137
-    /* do we have the source for the build process? */
138
-   if (!p_msg)
139
-      return NULL;
136
+	/* do we have the source for the build process? */
137
+	if (!p_msg)
138
+		return NULL;
140 139
 
141
-   /* allocs a new cell */
142
-   new_cell = (struct cell*)sh_malloc( sizeof( struct cell ) );
143
-   if  ( !new_cell )
144
-      return NULL;
140
+	/* allocs a new cell */
141
+	new_cell = (struct cell*)sh_malloc( sizeof( struct cell ) );
142
+	if  ( !new_cell )
143
+		return NULL;
145 144
 
146
-   /* filling with 0 */
147
-   memset( new_cell, 0, sizeof( struct cell ) );
145
+	/* filling with 0 */
146
+	memset( new_cell, 0, sizeof( struct cell ) );
148 147
 
149
-   new_cell->outbound_response.retr_timer.tg=TG_RT;
150
-   new_cell->outbound_response.fr_timer.tg=TG_FR;
151
-   new_cell->wait_tl.tg=TG_WT;
152
-   new_cell->dele_tl.tg=TG_DEL;
148
+	new_cell->outbound_response.retr_timer.tg=TG_RT;
149
+	new_cell->outbound_response.fr_timer.tg=TG_FR;
150
+	new_cell->wait_tl.tg=TG_WT;
151
+	new_cell->dele_tl.tg=TG_DEL;
153 152
 
154
-   /* hash index of the entry */
155
-   /* new_cell->hash_index = hash( p_msg->callid->body , get_cseq(p_msg)->number ); */
153
+	/* hash index of the entry */
156 154
 	new_cell->hash_index = p_msg->hash_index;
157
-   /* mutex */
158
-   /* ref counter is 0 */
159
-   /* all pointers from timers list tl are NULL */
160
-   new_cell->wait_tl.payload = new_cell;
161
-   new_cell->dele_tl.payload = new_cell;
162
-
163
-   new_cell->inbound_request =  sip_msg_cloner(p_msg) ;
164
-   if (!new_cell->inbound_request)
165
-	goto error;
166
-   new_cell->relaied_reply_branch   = -1;
167
-   new_cell->T_canceled = T_UNDEFINED;
168
-   new_cell->tag=&(get_to(new_cell->inbound_request)->tag_value);
155
+	/* mutex */
156
+	/* ref counter is 0 */
157
+	/* all pointers from timers list tl are NULL */
158
+	new_cell->wait_tl.payload = new_cell;
159
+	new_cell->dele_tl.payload = new_cell;
160
+
161
+	new_cell->inbound_request =  sip_msg_cloner(p_msg) ;
162
+	if (!new_cell->inbound_request)
163
+		goto error;
164
+	new_cell->relaied_reply_branch   = -1;
165
+	new_cell->T_canceled = T_UNDEFINED;
166
+	new_cell->tag=&(get_to(new_cell->inbound_request)->tag_value);
169 167
 #ifndef USE_SYNONIM
170
-   src[0]= p_msg->from->body;
171
-   src[1]= p_msg->to->body;
172
-   src[2]= p_msg->callid->body;
173
-   src[3]= p_msg->first_line.u.request.uri;
174
-   src[4]= get_cseq( p_msg )->number;
175
-   MDStringArray ( new_cell->md5, src, 5 );
176
-
168
+	src[0]= p_msg->from->body;
169
+	src[1]= p_msg->to->body;
170
+	src[2]= p_msg->callid->body;
171
+	src[3]= p_msg->first_line.u.request.uri;
172
+	src[4]= get_cseq( p_msg )->number;
173
+	MDStringArray ( new_cell->md5, src, 5 );
177 174
 #endif
178 175
 
179
-    init_cell_lock(  new_cell );
176
+	init_cell_lock(  new_cell );
180 177
 
181
-   return new_cell;
178
+	return new_cell;
182 179
 
183 180
 error:
184 181
 	sh_free(new_cell);
... ...
@@ -75,7 +75,6 @@ int new_hash( str call_id, str cseq_nr )
75 75
 	int hash_code = 0;
76 76
 	int i,j, k, third;
77 77
 	int ci_len, cs_len;
78
-	char c;
79 78
 	char *ci, *cs;
80 79
 
81 80
 	/* trim EoLs */
... ...
@@ -96,8 +95,8 @@ int new_hash( str call_id, str cseq_nr )
96 95
 	third=(ci_len-1)/3;
97 96
 	for ( i=ci_len-1, j=2*third, k=third;
98 97
 		k>0 ; i--, j--, k-- ) {
99
-		hash_code+=crc_16_tab[*(ci+i) /*+7*/ ]+
100
-			ccitt_tab[*(ci+k)+63]+	
98
+		hash_code+=crc_16_tab[(unsigned char)(*(ci+i)) /*+7*/ ]+
99
+			ccitt_tab[*(ci+k)+63]+
101 100
 			ccitt_tab[*(ci+j)+13];
102 101
 	}
103 102
 	for( i=0 ; i<cs_len ; i++ )
... ...
@@ -111,7 +110,7 @@ int new_hash( str call_id, str cseq_nr )
111 110
 void hashtest_cycle( int hits[TABLE_ENTRIES], char *ip )
112 111
 {
113 112
 	long int i,j,k, l;
114
-	int len1, len2, hashv;
113
+	int  hashv;
115 114
 	static char buf1[1024];
116 115
 	static char buf2[1024];
117 116
 	str call_id; 
... ...
@@ -124,8 +123,9 @@ void hashtest_cycle( int hits[TABLE_ENTRIES], char *ip )
124 123
 		for (j=85296341;j<85296341+10;j++)
125 124
 			for (k=987654;k<=987654+10;k++)
126 125
 				for (l=101;l<201;l++) {
127
-					call_id.len=sprintf( buf1, "%d-%d-%d@%s", i,j,k, ip );
128
-					cseq.len=sprintf( buf2, "%d", l );
126
+					call_id.len=sprintf( buf1, "%d-%d-%d@%s",(int)i,(int)j,
127
+						(int)k, ip );
128
+					cseq.len=sprintf( buf2, "%d", (int)l );
129 129
 					printf("%s\t%s\n", buf1, buf2 );
130 130
 					hashv=hash( call_id, cseq );
131 131
 					hits[ hashv ]++;
... ...
@@ -75,6 +75,8 @@ static int change_semaphore( ser_lock_t s  , int val );
75 75
 
76 76
 int init_cell_lock( struct cell *cell );
77 77
 int init_entry_lock( struct s_table* hash_table, struct entry *entry );
78
+int init_timerlist_lock( struct s_table* hash_table, enum lists timerlist_id);
79
+
78 80
 
79 81
 int release_cell_lock( struct cell *cell );
80 82
 int release_entry_lock( struct entry *entry );
... ...
@@ -415,3 +415,6 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
415 415
 }
416 416
 
417 417
 
418
+
419
+
420
+
... ...
@@ -9,7 +9,7 @@
9 9
 #include "../../config.h"
10 10
 #include "../../parser_f.h"
11 11
 #include "../../ut.h"
12
-#include "../../timer.h"
12
+//#include "../../timer.h"
13 13
 
14 14
 
15 15
 
... ...
@@ -32,83 +32,6 @@ void timer_routine(unsigned int, void*);
32 32
 
33 33
 
34 34
 
35
-
36
-
37
-/* remove from timer list */
38
-inline void reset_timer( struct s_table *hash_table, struct timer_link* tl )
39
-{
40
-	/* lock(timer_group_lock[ tl->tg ]); */
41
-	/* hack to work arround this timer group thing*/
42
-	lock(hash_table->timers[timer_group[tl->tg]].mutex);
43
-	remove_timer_unsafe( tl );
44
-	unlock(hash_table->timers[timer_group[tl->tg]].mutex);
45
-	/*unlock(timer_group_lock[ tl->tg ]);*/
46
-}
47
-
48
-
49
-
50
-
51
-/* determine timer length and put on a correct timer list */
52
-inline void set_timer( struct s_table *hash_table, struct timer_link *new_tl,
53
-														enum lists list_id )
54
-{
55
-	unsigned int timeout;
56
-	struct timer* list;
57
-	static enum lists to_table[NR_OF_TIMER_LISTS] = {
58
-		FR_TIME_OUT, INV_FR_TIME_OUT, WT_TIME_OUT, DEL_TIME_OUT,
59
-		RETR_T1, RETR_T1 << 1, RETR_T1 << 2, RETR_T2 };
60
-
61
-	if (list_id<FR_TIMER_LIST || list_id>=NR_OF_TIMER_LISTS) {
62
-		LOG(L_CRIT, "ERROR: set_timer: unkown list: %d\n", list_id);
63
-#ifdef EXTRA_DEBUG
64
-		abort();
65
-#endif
66
-		return;
67
-	}
68
-	timeout = to_table[ list_id ];
69
-	list= &(hash_table->timers[ list_id ]);
70
-
71
-	lock(list->mutex);
72
-	/* make sure I'm not already on a list */
73
-	remove_timer_unsafe( new_tl );
74
-	add_timer_unsafe( list, new_tl, get_ticks()+timeout);
75
-	unlock(list->mutex);
76
-}
77
-
78
-
79
-
80
-
81
-static inline void reset_retr_timers( struct s_table *h_table,
82
-													struct cell *p_cell )
83
-{
84
-	int ijk;
85
-	struct retrans_buff *rb;
86
-
87
-	/* lock the first timer list of the FR group -- all other
88
-	   lists share the same lock*/
89
-	lock(hash_table->timers[RT_T1_TO_1].mutex);
90
-	remove_timer_unsafe( & p_cell->outbound_response.retr_timer );
91
-	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
92
-		if ( rb = p_cell->outbound_request[ijk] ) {
93
-			remove_timer_unsafe( & rb->retr_timer );
94
-		}
95
-	}
96
-	unlock(hash_table->timers[RT_T1_TO_1].mutex);
97
-
98
-	lock(hash_table->timers[FR_TIMER_LIST].mutex);
99
-	remove_timer_unsafe( & p_cell->outbound_response.fr_timer );
100
-	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
101
-		if ( rb = p_cell->outbound_request[ijk] ) {
102
-			remove_timer_unsafe( & rb->fr_timer );
103
-		}
104
-	}
105
-	unlock(hash_table->timers[FR_TIMER_LIST].mutex);
106
-	DBG("DEBUG:stop_RETR_and_FR_timers : timers stopped\n");
107
-}
108
-
109
-
110
-
111
-
112 35
 int tm_startup()
113 36
 {
114 37
 	/* building the hash table*/
... ...
@@ -344,9 +267,8 @@ int t_should_relay_response( struct cell *Trans , int new_code,
344 267
   */
345 268
 int t_put_on_wait(  struct cell  *Trans  )
346 269
 {
347
-	struct timer_link *tl;
348 270
 	unsigned int i;
349
-	struct retrans_buff* rb;
271
+	//struct retrans_buff* rb;
350 272
 
351 273
 #ifndef WAIT
352 274
 	if (is_in_timer_list2( &(Trans->wait_tl)))
... ...
@@ -414,6 +336,7 @@ int t_put_on_wait(  struct cell  *Trans  )
414 336
 int t_cancel_branch(unsigned int branch)
415 337
 {
416 338
 	LOG(L_ERR, "ERROR: t_cancel_branch: NOT IMPLEMENTED YET\n");
339
+	return 1;
417 340
 }
418 341
 
419 342
 
... ...
@@ -565,7 +488,6 @@ int t_build_and_send_CANCEL(struct cell *Trans,unsigned int branch)
565 488
 	struct hdr_field    *hdr;
566 489
 	char                *cancel_buf, *p, *via;
567 490
 	unsigned int         len, via_len;
568
-	int                  n;
569 491
 	struct retrans_buff *srb;
570 492
 
571 493
 	if (Trans->outbound_cancel[branch]!=NO_CANCEL)
... ...
@@ -846,7 +768,7 @@ inline void retransmission_handler( void *attr)
846 768
 {
847 769
 	struct retrans_buff* r_buf ;
848 770
 	enum lists id;
849
-	DBG("DEBUG: entering retransmisson with attr = %x\n",attr);
771
+	DBG("DEBUG: entering retransmisson with attr = %p\n",attr);
850 772
 	r_buf = (struct retrans_buff*)attr;
851 773
 #ifdef EXTRA_DEBUG
852 774
 	if (r_buf->my_T->damocles) {
... ...
@@ -991,7 +913,6 @@ inline void delete_handler( void *attr)
991 913
 void timer_routine(unsigned int ticks , void * attr)
992 914
 {
993 915
 	struct s_table    *hash_table = (struct s_table *)attr;
994
-	struct timer*      timers= hash_table->timers;
995 916
 	struct timer_link *tl, *tmp_tl;
996 917
 	int                id;
997 918
 
... ...
@@ -1043,7 +964,6 @@ struct retrans_buff *build_ack( struct sip_msg* rpl, struct cell *trans, int bra
1043 964
 	struct hdr_field    *hdr;
1044 965
 	char                *ack_buf, *p, *via;
1045 966
 	unsigned int         len, via_len;
1046
-	int                  n;
1047 967
 	struct retrans_buff *srb;
1048 968
 
1049 969
 	ack_buf = 0;
... ...
@@ -13,6 +13,7 @@
13 13
 #include "../../globals.h"
14 14
 #include "../../udp_server.h"
15 15
 #include "../../msg_translator.h"
16
+#include "../../timer.h"
16 17
 #include "../../forward.h"
17 18
 #include "../../mem/mem.h"
18 19
 
... ...
@@ -259,8 +260,6 @@ int t_should_relay_response( struct cell *Trans, int new_code, int branch,
259 260
 int t_update_timers_after_sending_reply( struct retrans_buff *rb );
260 261
 int t_put_on_wait(  struct cell  *Trans  );
261 262
 int relay_lowest_reply_upstream( struct cell *Trans , struct sip_msg *p_msg );
262
-static int push_reply( struct cell* trans , unsigned int branch ,
263
-	char *buf, unsigned int len);
264 263
 int add_branch_label( struct cell *Trans, struct sip_msg *p_msg , int branch );
265 264
 int get_ip_and_port_from_uri( struct sip_msg* p_msg , unsigned int *param_ip,
266 265
 	unsigned int *param_port);
... ...
@@ -304,4 +303,82 @@ inline int static relay_ack( struct cell *t, int branch,
304 303
 }
305 304
 
306 305
 
306
+
307
+
308
+/* remove from timer list */
309
+static inline void reset_timer( struct s_table *hash_table,
310
+													struct timer_link* tl )
311
+{
312
+	/* lock(timer_group_lock[ tl->tg ]); */
313
+	/* hack to work arround this timer group thing*/
314
+	lock(hash_table->timers[timer_group[tl->tg]].mutex);
315
+	remove_timer_unsafe( tl );
316
+	unlock(hash_table->timers[timer_group[tl->tg]].mutex);
317
+	/*unlock(timer_group_lock[ tl->tg ]);*/
318
+}
319
+
320
+
321
+
322
+
323
+/* determine timer length and put on a correct timer list */
324
+static inline void set_timer( struct s_table *hash_table,
325
+							struct timer_link *new_tl, enum lists list_id )
326
+{
327
+	unsigned int timeout;
328
+	struct timer* list;
329
+	static enum lists to_table[NR_OF_TIMER_LISTS] = {
330
+		FR_TIME_OUT, INV_FR_TIME_OUT, WT_TIME_OUT, DEL_TIME_OUT,
331
+		RETR_T1, RETR_T1 << 1, RETR_T1 << 2, RETR_T2 };
332
+
333
+	if (list_id<FR_TIMER_LIST || list_id>=NR_OF_TIMER_LISTS) {
334
+		LOG(L_CRIT, "ERROR: set_timer: unkown list: %d\n", list_id);
335
+#ifdef EXTRA_DEBUG
336
+		abort();
307 337
 #endif
338
+		return;
339
+	}
340
+	timeout = to_table[ list_id ];
341
+	list= &(hash_table->timers[ list_id ]);
342
+
343
+	lock(list->mutex);
344
+	/* make sure I'm not already on a list */
345
+	remove_timer_unsafe( new_tl );
346
+	add_timer_unsafe( list, new_tl, get_ticks()+timeout);
347
+	unlock(list->mutex);
348
+}
349
+
350
+
351
+
352
+
353
+static inline void reset_retr_timers( struct s_table *h_table,
354
+													struct cell *p_cell )
355
+{
356
+	int ijk;
357
+	struct retrans_buff *rb;
358
+
359
+	/* lock the first timer list of the FR group -- all other
360
+	   lists share the same lock*/
361
+	lock(hash_table->timers[RT_T1_TO_1].mutex);
362
+	remove_timer_unsafe( & p_cell->outbound_response.retr_timer );
363
+	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
364
+		if ( (rb = p_cell->outbound_request[ijk]) ) {
365
+			remove_timer_unsafe( & rb->retr_timer );
366
+		}
367
+	}
368
+	unlock(hash_table->timers[RT_T1_TO_1].mutex);
369
+
370
+	lock(hash_table->timers[FR_TIMER_LIST].mutex);
371
+	remove_timer_unsafe( & p_cell->outbound_response.fr_timer );
372
+	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
373
+		if ( (rb = p_cell->outbound_request[ijk]) ) {
374
+			remove_timer_unsafe( & rb->fr_timer );
375
+		}
376
+	}
377
+	unlock(hash_table->timers[FR_TIMER_LIST].mutex);
378
+	DBG("DEBUG:stop_RETR_and_FR_timers : timers stopped\n");
379
+}
380
+
381
+
382
+
383
+#endif
384
+
... ...
@@ -18,13 +18,13 @@
18 18
 int t_forward_nonack( struct sip_msg* p_msg , unsigned int dest_ip_param ,
19 19
 	unsigned int dest_port_param )
20 20
 {
21
-	unsigned int dest_ip     = dest_ip_param;
22
-	unsigned int dest_port  = dest_port_param;
23
-	int	branch;
24
-	unsigned int len;
25
-	char               *buf, *shbuf;
26
-	struct retrans_buff *rb;
27
-	struct cell      *T_source = T;
21
+	unsigned int        dest_ip = dest_ip_param;
22
+	unsigned int        dest_port = dest_port_param;
23
+	int                  branch;
24
+	unsigned int         len;
25
+	char                *buf, *shbuf;
26
+	struct retrans_buff *rb = 0;
27
+	struct cell         *T_source = T;
28 28
 
29 29
 
30 30
 	buf=NULL;
... ...
@@ -161,15 +161,16 @@ error:
161 161
 }
162 162
 
163 163
 int t_forward_ack( struct sip_msg* p_msg , unsigned int dest_ip_param ,
164
-	unsigned int dest_port_param )
164
+										unsigned int dest_port_param )
165 165
 {
166
-
167 166
 	int branch;
168 167
 	int len;
169 168
 	char *buf;
170
-	struct sockaddr_in to_sock;
171
-	struct retrans_buff *rb;
172 169
 	struct retrans_buff *srb;
170
+#ifdef _DONT_USE
171
+	struct sockaddr_in to_sock;
172
+#endif
173
+
173 174
 
174 175
 
175 176
 	/* drop local ACKs */
... ...
@@ -227,6 +228,7 @@ int t_forward_ack( struct sip_msg* p_msg , unsigned int dest_ip_param ,
227 228
 	relay_ack( T, branch, srb, len );
228 229
 	return 1;
229 230
 
231
+#ifdef _DON_USE
230 232
 fwd_sl: /* some strange conditions occured; try statelessly */
231 233
 	LOG(L_ERR, "ERROR: fwd-ing a 2xx ACK with T-state failed; "
232 234
 		"trying statelessly\n");
... ...
@@ -238,4 +240,5 @@ fwd_sl: /* some strange conditions occured; try statelessly */
238 240
 		sizeof(struct sockaddr_in) );
239 241
 	free( buf );
240 242
 	return 1;
243
+#endif
241 244
 }
... ...
@@ -221,7 +221,7 @@ struct cell* t_lookupOriginalT(  struct s_table* hash_table ,
221 221
 					&& EQ_STR(from) )
222 222
 					{ /* WE FOUND THE GOLDEN EGG !!!! */
223 223
 						DBG("DEBUG: t_lookupOriginalT: canceled transaction"
224
-							" found (%x)! \n",p_cell );
224
+							" found (%p)! \n",p_cell );
225 225
 						return p_cell;
226 226
 					}
227 227
 		/* next transaction */
... ...
@@ -244,13 +244,16 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch ,
244 244
 												unsigned int *local_cancel)
245 245
 {
246 246
 	struct cell*  p_cell;
247
-	unsigned int loop_code    = 0;
248 247
 	unsigned int hash_index   = 0;
249 248
 	unsigned int entry_label  = 0;
250 249
 	unsigned int branch_id    = 0;
251
-	char  *loopi,*hashi, *syni, *branchi, *p, *n;
252
-	int loopl,hashl, synl, branchl;
250
+	char  *hashi, *syni, *branchi, *p, *n;
251
+	int hashl, synl, branchl;
253 252
 	int scan_space;
253
+#ifndef USE_SYNONIM
254
+	char *loopi;
255
+	int loopl;
256
+#endif
254 257
 
255 258
 	/* split the branch into pieces: loop_detection_check(ignored),
256 259
 	 hash_table_id, synonym_id, branch_id */
... ...
@@ -356,8 +359,6 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch ,
356 359
 	/* nothing found */
357 360
 	DBG("DEBUG: t_reply_matching: no matching transaction exists\n");
358 361
 
359
-nomatch:
360
-	unlock(&(hash_table->entrys[hash_index].mutex));
361 362
 nomatch2:
362 363
 	DBG("DEBUG: t_reply_matching: failure to match a transaction\n");
363 364
 	*p_branch = -1;
... ...
@@ -425,10 +426,8 @@ int t_check( struct sip_msg* p_msg , int *param_branch, int *param_cancel)
425 426
 */
426 427
 int add_branch_label( struct cell *trans, struct sip_msg *p_msg, int branch )
427 428
 {
428
-	char *c;
429
-
430 429
 	char *begin;
431
-	unsigned int size, orig_size, n;
430
+	unsigned int size, orig_size;
432 431
 
433 432
 	begin=p_msg->add_to_branch_s+p_msg->add_to_branch_len;
434 433
 	orig_size = size=MAX_BRANCH_PARAM_LEN - p_msg->add_to_branch_len;
... ...
@@ -446,7 +445,7 @@ int add_branch_label( struct cell *trans, struct sip_msg *p_msg, int branch )
446 445
 	if (int2reverse_hex( &begin, &size, branch)==-1) return -1;
447 446
 
448 447
 	p_msg->add_to_branch_len+=(orig_size-size);
449
-	DBG("DEBUG: XXX branch label created now: %.*s (%d)\n",
448
+	DBG("DEBUG: XXX branch label created now: %.*s\n",
450 449
 		p_msg->add_to_branch_len, p_msg->add_to_branch_s );
451 450
 	return 0;
452 451
 
... ...
@@ -51,7 +51,7 @@ int t_retransmit_reply( /* struct sip_msg* p_msg    */ )
51 51
 int t_send_reply(  struct sip_msg* p_msg , unsigned int code , char * text )
52 52
 {
53 53
 	unsigned int len, buf_len;
54
-	char * buf, *shbuf;
54
+	char * buf;
55 55
 	struct retrans_buff *rb;
56 56
 
57 57
 	buf = build_res_buf_from_sip_req(code,text,T->tag->s,T->tag->len,
... ...
@@ -192,15 +192,15 @@ error:
192 192
   */
193 193
 int t_on_reply( struct sip_msg  *p_msg )
194 194
 {
195
-	unsigned int branch,len, msg_status, msg_class, save_clone;
195
+	unsigned int branch, msg_status, msg_class, save_clone;
196 196
 	unsigned int local_cancel;
197
-	struct sip_msg *clone, *backup;
197
+	struct sip_msg *clone=0, *backup=0;
198 198
 	int relay;
199 199
 	int start_fr = 0;
200 200
 	int is_invite;
201 201
 	/* retransmission structure of outbound reply and request */
202
-	struct retrans_buff *orq_rb, *orp_rb, *ack_rb;
203
-	char *buf;
202
+	struct retrans_buff *orq_rb=0, *orp_rb=0, *ack_rb=0;
203
+	char *buf=0;
204 204
 	/* length of outbound reply */
205 205
 	unsigned int orp_len;
206 206
 	/* buffer length (might be somewhat larger than message size */
... ...
@@ -342,8 +342,6 @@ int t_on_reply( struct sip_msg  *p_msg )
342 342
 		T->tag=&(get_to(clone)->tag_value);
343 343
 	}
344 344
 
345
-
346
-cleanup:
347 345
 	UNLOCK_REPLIES( T );
348 346
 	if (relay >= 0) {
349 347
 		SEND_PR_BUFFER( orp_rb, buf, orp_len );
... ...
@@ -7,6 +7,7 @@
7 7
 #include "h_table.h"
8 8
 #include "timer.h"
9 9
 #include "../../dprint.h"
10
+#include "lock.h"
10 11
 
11 12
 int timer_group[NR_OF_TIMER_LISTS] = 
12 13
 {
... ...
@@ -117,7 +118,7 @@ void add_timer_unsafe( struct timer *timer_list, struct timer_link *tl,
117 118
 struct timer_link  *check_and_split_time_list( struct timer *timer_list,
118 119
 																int time )
119 120
 {
120
-	struct timer_link *tl , *tmp , *end, *ret;
121
+	struct timer_link *tl , *end, *ret;
121 122
 
122 123
 	/* quick check whether it is worth entering the lock */
123 124
 	if (timer_list->first_tl.next_tl==&timer_list->last_tl ||
... ...
@@ -5,7 +5,6 @@
5 5
 #ifndef _TIMER_H
6 6
 #define _TIMER_H
7 7
 
8
-#include "lock.h"
9 8
 
10 9
 
11 10
 
... ...
@@ -29,6 +28,7 @@ enum lists
29 28
 extern int timer_group[NR_OF_TIMER_LISTS];
30 29
 struct timer;
31 30
 
31
+#include "lock.h"
32 32
 
33 33
 
34 34
 /* all you need to put a cell in a timer list
... ...
@@ -25,10 +25,10 @@ static int w_t_check(struct sip_msg* msg, char* str, char* str2);
25 25
 static int w_t_send_reply(struct sip_msg* msg, char* str, char* str2);
26 26
 static int w_t_release(struct sip_msg* msg, char* str, char* str2);
27 27
 static int fixup_t_forward(void** param, int param_no);
28
-static int fixup_t_forward_def(void** param, int param_no);
28
+//static int fixup_t_forward_def(void** param, int param_no);
29 29
 static int fixup_t_send_reply(void** param, int param_no);
30 30
 static int w_t_unref( struct sip_msg* p_msg, char* foo, char* bar );
31
-static w_t_retransmit_reply( struct sip_msg* p_msg, char* foo, char* bar  );
31
+static int w_t_retransmit_reply(struct sip_msg* p_msg, char* foo, char* bar );
32 32
 static int w_t_add_transaction( struct sip_msg* p_msg, char* foo, char* bar );
33 33
 
34 34
 static int t_relay_to( struct sip_msg  *p_msg ,  char *str_ip , char *str_port  );
... ...
@@ -151,7 +151,7 @@ static int fixup_t_forward(void** param, int param_no)
151 151
 			return 0;
152 152
 		}else{
153 153
 			LOG(L_ERR, "TM module:fixup_t_forward: bad port number <%s>\n",
154
-					*param);
154
+					(char*)(*param));
155 155
 			return E_UNSPEC;
156 156
 		}
157 157
 	}
... ...
@@ -159,7 +159,7 @@ static int fixup_t_forward(void** param, int param_no)
159 159
 }
160 160
 
161 161
 
162
-
162
+/*
163 163
 static int fixup_t_forward_def(void** param, int param_no)
164 164
 {
165 165
 	char* name;
... ...
@@ -180,7 +180,7 @@ static int fixup_t_forward_def(void** param, int param_no)
180 180
 			goto copy;
181 181
 		}
182 182
 #endif
183
-		/* fail over to normal lookup */
183
+		/ fail over to normal lookup /
184 184
 		he=gethostbyname(name);
185 185
 		if (he==0){
186 186
 			LOG(L_CRIT, "ERROR: mk_proxy: could not resolve hostname:"
... ...
@@ -195,7 +195,7 @@ static int fixup_t_forward_def(void** param, int param_no)
195 195
 	}
196 196
 	return 0;
197 197
 }
198
-
198
+*/
199 199
 
200 200
 
201 201
 static int fixup_t_send_reply(void** param, int param_no)
... ...
@@ -211,7 +211,7 @@ static int fixup_t_send_reply(void** param, int param_no)
211 211
 			return 0;
212 212
 		}else{
213 213
 			LOG(L_ERR, "TM module:fixup_t_send_reply: bad  number <%s>\n",
214
-					*param);
214
+					(char*)(*param));
215 215
 			return E_UNSPEC;
216 216
 		}
217 217
 	}
... ...
@@ -274,11 +274,15 @@ static int w_t_unref( struct sip_msg* p_msg, char* foo, char* bar )
274 274
     return t_unref( /* p_msg */ );
275 275
 }
276 276
 
277
-static w_t_retransmit_reply( struct sip_msg* p_msg, char* foo, char* bar  )
277
+static int w_t_retransmit_reply( struct sip_msg* p_msg, char* foo, char* bar)
278 278
 {
279
-	if (t_check( p_msg  , 0 , 0 )==-1) return 1;
280
-	if (T) return t_retransmit_reply( p_msg );
281
-	else return -1;
279
+	if (t_check( p_msg  , 0 , 0 )==-1) 
280
+		return 1;
281
+	if (T)
282
+		return t_retransmit_reply( p_msg );
283
+	else 
284
+		return -1;
285
+	return 1;
282 286
 }
283 287
 
284 288
 static int w_t_add_transaction( struct sip_msg* p_msg, char* foo, char* bar ) {
... ...
@@ -294,9 +298,9 @@ static int w_t_add_transaction( struct sip_msg* p_msg, char* foo, char* bar ) {
294 298
 
295 299
 static int t_relay_to( struct sip_msg  *p_msg , char *str_ip , char *str_port)
296 300
 {
297
-
301
+	struct proxy_l *proxy;
298 302
 	enum addifnew_status status;
299
-	int ret;
303
+	int ret=0;
300 304
 
301 305
 	status = t_addifnew( p_msg );
302 306
 
... ...
@@ -332,8 +336,10 @@ static int t_relay_to( struct sip_msg  *p_msg , char *str_ip , char *str_port)
332 336
 			break;
333 337
 		case AIN_NEWACK:	/* it's an ACK for which no transaction exists */
334 338
 			DBG( "SER: forwarding ACK  statelessly\n");
335
-			forward_request( p_msg , mk_proxy_from_ip(
336
-				(unsigned int )str_ip, (unsigned int)str_port) ) ;
339
+			proxy=mk_proxy_from_ip((unsigned int)str_ip,(unsigned int)str_port);
340
+			forward_request( p_msg , proxy ) ;
341
+			free_proxy(proxy);
342
+			free(proxy);
337 343
 			ret=1;
338 344
 			break;
339 345
 		case AIN_OLDACK:	/* it's an ACK for an existing transaction */