2
0
Эх сурвалжийг харах

- added fast_locking to tm
(and changed lock & unlock call syntax)

Andrei Pelinescu-Onciul 23 жил өмнө
parent
commit
7d545d52de

+ 4 - 4
Makefile.defs

@@ -7,8 +7,8 @@
 #version number
 #version number
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 8
 PATCHLEVEL = 8
-SUBLEVEL = 6
-EXTRAVERSION = -6-beer
+SUBLEVEL = 7
+EXTRAVERSION = -0-unstable
 
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s)
 OS = $(shell uname -s)
@@ -59,8 +59,8 @@ ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ )
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
 	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
-	 -DF_MALLOC  #-DUSE_SYNONIM\
-	 #-DNO_DEBUG
+	 -DF_MALLOC  -DUSE_SYNONIM\
+	 -DNO_DEBUG
 	 #-DEXTRA_DEBUG 
 	 #-DEXTRA_DEBUG 
 	 #-DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
 	 #-DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
 	 #-DDBG_QM_MALLOC #-DNO_DEBUG
 	 #-DDBG_QM_MALLOC #-DNO_DEBUG

+ 4 - 4
modules/tm/h_table.c

@@ -206,9 +206,9 @@ void    insert_into_hash_table_unsafe( struct s_table *hash_table,  struct cell
 
 
 void insert_into_hash_table( struct s_table *hash_table,  struct cell * p_cell )
 void insert_into_hash_table( struct s_table *hash_table,  struct cell * p_cell )
 {
 {
-	lock( hash_table->entrys[ p_cell->hash_index ].mutex );
+	lock( &(hash_table->entrys[ p_cell->hash_index ].mutex) );
 	insert_into_hash_table_unsafe( hash_table,  p_cell );
 	insert_into_hash_table_unsafe( hash_table,  p_cell );
-	unlock( hash_table->entrys[ p_cell->hash_index ].mutex );
+	unlock( &(hash_table->entrys[ p_cell->hash_index ].mutex) );
 }
 }
 
 
 
 
@@ -221,7 +221,7 @@ void remove_from_hash_table( struct s_table *hash_table,  struct cell * p_cell )
    struct entry*  p_entry  = &(hash_table->entrys[p_cell->hash_index]);
    struct entry*  p_entry  = &(hash_table->entrys[p_cell->hash_index]);
 
 
    /* unlink the cell from entry list */
    /* unlink the cell from entry list */
-   lock( p_entry->mutex );
+   lock( &(p_entry->mutex) );
 
 
    if ( p_cell->prev_cell )
    if ( p_cell->prev_cell )
       p_cell->prev_cell->next_cell = p_cell->next_cell;
       p_cell->prev_cell->next_cell = p_cell->next_cell;
@@ -233,7 +233,7 @@ void remove_from_hash_table( struct s_table *hash_table,  struct cell * p_cell )
    else
    else
       p_entry->last_cell = p_cell->prev_cell;
       p_entry->last_cell = p_cell->prev_cell;
 
 
-   unlock( p_entry->mutex );
+   unlock( &(p_entry->mutex) );
 }
 }
 
 
 
 

+ 124 - 63
modules/tm/lock.c

@@ -9,7 +9,12 @@
 #include "timer.h"
 #include "timer.h"
 #include "../../dprint.h"
 #include "../../dprint.h"
 
 
+#ifdef FAST_LOCK
+#include "../../mem/shm_mem.h"
+#endif
+
 
 
+#ifndef FAST_LOCK
 /* semaphore probing limits */
 /* semaphore probing limits */
 #define SEM_MIN		16
 #define SEM_MIN		16
 #define SEM_MAX		4096
 #define SEM_MAX		4096
@@ -23,6 +28,8 @@
    ipc's dimensioning limitations and will provide us with
    ipc's dimensioning limitations and will provide us with
    fast unlimited (=no sharing) mutexing
    fast unlimited (=no sharing) mutexing
 
 
+  UPDATE: we do have now arch-dependent locking (-DFAST_LOCK)
+
    we allocate the locks according to the following plans:
    we allocate the locks according to the following plans:
 
 
    1) transaction timer lists have each a semaphore in
    1) transaction timer lists have each a semaphore in
@@ -51,11 +58,75 @@ static int sem_nr;
 ser_lock_t timer_group_lock[TG_NR];
 ser_lock_t timer_group_lock[TG_NR];
 
 
 
 
+/* return -1 if semget failed, -2 if semctl failed */
+static int init_semaphore_set( int size )
+{
+	int new_semaphore, i;
+
+	new_semaphore=semget ( IPC_PRIVATE, size, IPC_CREAT | IPC_PERMISSIONS );
+	if (new_semaphore==-1) {
+		DBG("DEBUG: init_semaphore_set(%d):  failure to allocate a"
+					" semaphore: %s\n", size, strerror(errno));
+		return -1;
+	}
+	for (i=0; i<size; i++) {
+                union semun {
+                        int val;
+                        struct semid_ds *buf;
+                        ushort *array;
+                } argument;
+                /* binary lock */
+                argument.val = +1;
+                if (semctl( new_semaphore, i , SETVAL , argument )==-1) {
+			DBG("DEBUG: init_semaphore_set:  failure to "
+						"initialize a semaphore: %s\n", strerror(errno));
+			if (semctl( entry_semaphore, 0 , IPC_RMID , 0 )==-1)
+				DBG("DEBUG: init_semaphore_set:  failure to release"
+						" a semaphore\n");
+			return -2;
+                }
+        }
+	return new_semaphore;
+}
 
 
-/* intitialize the locks; return 0 on success, -1 otherwise
-*/
 
 
 
 
+static int change_semaphore( ser_lock_t* s  , int val )
+{
+	struct sembuf pbuf;
+	int r;
+
+	pbuf.sem_num = s->semaphore_index ;
+	pbuf.sem_op =val;
+	pbuf.sem_flg = 0;
+
+tryagain:
+	r=semop( s->semaphore_set, &pbuf ,  1 /* just 1 op */ );
+
+	if (r==-1) {
+		if (errno==EINTR) {
+			DBG("signal received in a semaphore\n");
+			goto tryagain;
+		} else {
+			LOG(L_CRIT, "ERROR: change_semaphore(%x, %x, 1) : %s\n",
+					s->semaphore_set, &pbuf,
+					strerror(errno));
+		}
+	}
+	return r;
+}
+#endif  /* !FAST_LOCK*/
+
+
+
+/* intitialize the locks; return 0 on success, -1 otherwise
+*/
+#ifdef FAST_LOCK
+int lock_initialize()
+{
+	return 0;
+}
+#else
 int lock_initialize()
 int lock_initialize()
 {
 {
 	int i;
 	int i;
@@ -169,38 +240,16 @@ error:
 	return -1;
 	return -1;
 }
 }
 
 
-/* return -1 if semget failed, -2 if semctl failed */
-static int init_semaphore_set( int size )
-{
-	int new_semaphore, i;
+#endif /*FAST_LOCK*/
 
 
-	new_semaphore=semget ( IPC_PRIVATE, size, IPC_CREAT | IPC_PERMISSIONS );
-	if (new_semaphore==-1) {
-		DBG("DEBUG: init_semaphore_set(%d):  failure to allocate a"
-					" semaphore: %s\n", size, strerror(errno));
-		return -1;
-	}
-	for (i=0; i<size; i++) {
-                union semun {
-                        int val;
-                        struct semid_ds *buf;
-                        ushort *array;
-                } argument;
-                /* binary lock */
-                argument.val = +1;
-                if (semctl( new_semaphore, i , SETVAL , argument )==-1) {
-			DBG("DEBUG: init_semaphore_set:  failure to "
-						"initialize a semaphore: %s\n", strerror(errno));
-			if (semctl( entry_semaphore, 0 , IPC_RMID , 0 )==-1)
-				DBG("DEBUG: init_semaphore_set:  failure to release"
-						" a semaphore\n");
-			return -2;
-                }
-        }
-	return new_semaphore;
+#ifdef FAST_LOCK
+void lock_cleanup()
+{
+	/* must check if someone uses them, for now just leave them allocated*/
+	LOG(L_INFO, "INFO: lock_cleanup:  clean-up still not implemented properly \n");
 }
 }
 
 
-
+#else
 
 
 /* remove the semaphore set from system */
 /* remove the semaphore set from system */
 void lock_cleanup()
 void lock_cleanup()
@@ -229,71 +278,66 @@ void lock_cleanup()
 	entry_semaphore = timer_semaphore = reply_semaphore = ack_semaphore = 0;
 	entry_semaphore = timer_semaphore = reply_semaphore = ack_semaphore = 0;
 
 
 }
 }
-
+#endif /*FAST_LOCK*/
 
 
 
 
 /* lock sempahore s */
 /* lock sempahore s */
 #ifdef DBG_LOCK
 #ifdef DBG_LOCK
-inline int _lock( ser_lock_t s , char *file, char *function, unsigned int line )
+inline int _lock( ser_lock_t* s , char *file, char *function, unsigned int line )
 #else
 #else
-inline int _lock( ser_lock_t s )
+inline int _lock( ser_lock_t* s )
 #endif
 #endif
 {
 {
 #ifdef DBG_LOCK
 #ifdef DBG_LOCK
 	DBG("DEBUG: lock : entered from %s , %s(%d)\n", function, file, line );
 	DBG("DEBUG: lock : entered from %s , %s(%d)\n", function, file, line );
 #endif
 #endif
+#ifdef FAST_LOCK
+	get_lock(s);
+	return 0;
+#else
 	return change_semaphore( s, -1 );
 	return change_semaphore( s, -1 );
+#endif
 }
 }
 
 
 #ifdef DBG_LOCK
 #ifdef DBG_LOCK
-inline int _unlock( ser_lock_t s, char *file, char *function, unsigned int line )
+inline int _unlock( ser_lock_t* s, char *file, char *function, unsigned int line )
 #else
 #else
-inline int _unlock( ser_lock_t s )
+inline int _unlock( ser_lock_t* s )
 #endif
 #endif
 {
 {
 #ifdef DBG_LOCK
 #ifdef DBG_LOCK
 	DBG("DEBUG: unlock : entered from %s, %s:%d\n", file, function, line );
 	DBG("DEBUG: unlock : entered from %s, %s:%d\n", file, function, line );
 #endif
 #endif
-	
+#ifdef FAST_LOCK
+	release_lock(s);
+	return 0;
+#else
 	return change_semaphore( s, +1 );
 	return change_semaphore( s, +1 );
+#endif
 }
 }
 
 
-static int change_semaphore( ser_lock_t s  , int val )
-{
-	struct sembuf pbuf;
-	int r;
-
-	pbuf.sem_num = s.semaphore_index ;
-	pbuf.sem_op =val;
-	pbuf.sem_flg = 0;
-
-tryagain:
-	r=semop( s.semaphore_set, &pbuf ,  1 /* just 1 op */ );
-
-	if (r==-1) {
-		if (errno==EINTR) {
-			DBG("signal received in a semaphore\n");
-			goto tryagain;
-		} else {
-			LOG(L_CRIT, "ERROR: change_semaphore(%x, %x, 1) : %s\n",
-					s.semaphore_set, &pbuf,
-					strerror(errno));
-		}
-	}
-	return r;
-}
 
 
 
 
 int init_cell_lock( struct cell *cell )
 int init_cell_lock( struct cell *cell )
 {
 {
+#ifdef FAST_LOCK
+	init_lock(cell->reply_mutex);
+	init_lock(cell->ack_mutex);
+	return 0;
+#else
 	cell->reply_mutex.semaphore_set=reply_semaphore;
 	cell->reply_mutex.semaphore_set=reply_semaphore;
 	cell->reply_mutex.semaphore_index = cell->hash_index % sem_nr;
 	cell->reply_mutex.semaphore_index = cell->hash_index % sem_nr;
 	cell->ack_mutex.semaphore_set=ack_semaphore;
 	cell->ack_mutex.semaphore_set=ack_semaphore;
 	cell->ack_mutex.semaphore_index = cell->hash_index % sem_nr;
 	cell->ack_mutex.semaphore_index = cell->hash_index % sem_nr;
+#endif
+	return 0;
 }
 }
 
 
 int init_entry_lock( struct s_table* hash_table, struct entry *entry )
 int init_entry_lock( struct s_table* hash_table, struct entry *entry )
 {
 {
+#ifdef FAST_LOCK
+	init_lock(entry->mutex);
+#else
 	/* just advice which of the available semaphores to use;
 	/* just advice which of the available semaphores to use;
 	   specifically, all entries are partitioned into as
 	   specifically, all entries are partitioned into as
 	   many partitions as number of available semaphors allows
 	   many partitions as number of available semaphors allows
@@ -301,11 +345,15 @@ int init_entry_lock( struct s_table* hash_table, struct entry *entry )
 	entry->mutex.semaphore_set=entry_semaphore;
 	entry->mutex.semaphore_set=entry_semaphore;
 	entry->mutex.semaphore_index = ( ((void *)entry - (void *)(hash_table->entrys ) )
 	entry->mutex.semaphore_index = ( ((void *)entry - (void *)(hash_table->entrys ) )
                / sizeof(struct entry) ) % sem_nr;
                / sizeof(struct entry) ) % sem_nr;
-
+#endif
+	return 0;
 }
 }
 
 
 int init_timerlist_lock( struct s_table* hash_table, enum lists timerlist_id)
 int init_timerlist_lock( struct s_table* hash_table, enum lists timerlist_id)
 {
 {
+#ifdef FAST_LOCK
+	init_lock(hash_table->timers[timerlist_id].mutex);
+#else
 	/* each timer list has its own semaphore */
 	/* each timer list has its own semaphore */
 	/*
 	/*
 	hash_table->timers[timerlist_id].mutex.semaphore_set=timer_semaphore;
 	hash_table->timers[timerlist_id].mutex.semaphore_set=timer_semaphore;
@@ -313,22 +361,35 @@ int init_timerlist_lock( struct s_table* hash_table, enum lists timerlist_id)
 	*/
 	*/
 
 
 	hash_table->timers[timerlist_id].mutex=timer_group_lock[ timer_group[timerlist_id] ];
 	hash_table->timers[timerlist_id].mutex=timer_group_lock[ timer_group[timerlist_id] ];
+#endif
+	return 0;
 }
 }
 
 
+
+
 int release_cell_lock( struct cell *cell )
 int release_cell_lock( struct cell *cell )
 {
 {
+#ifndef FAST_LOCK
 	/* don't do anything here -- the init_*_lock procedures
 	/* don't do anything here -- the init_*_lock procedures
 	   just advised on usage of shared semaphores but did not
 	   just advised on usage of shared semaphores but did not
 	   generate them
 	   generate them
 	*/
 	*/
+#endif
+	return 0;
 }
 }
 
 
+
+
 int release_entry_lock( struct entry *entry )
 int release_entry_lock( struct entry *entry )
 {
 {
 	/* the same as above */
 	/* the same as above */
+	return 0;
 }
 }
 
 
-release_timerlist_lock( struct timer *timerlist )
+
+
+int release_timerlist_lock( struct timer *timerlist )
 {
 {
 	/* the same as above */
 	/* the same as above */
+	return 0;
 }
 }

+ 29 - 11
modules/tm/lock.h

@@ -11,12 +11,22 @@
 #include <sys/sem.h>
 #include <sys/sem.h>
 
 
 
 
+
+#ifdef  FAST_LOCK
+#include "../../fastlock.h"
+#endif
+
+#ifdef FAST_LOCK
+#define ser_lock_t fl_lock_t
+#else
 /* typedef to structure we use for mutexing;
 /* typedef to structure we use for mutexing;
    currently, index to a semaphore set identifier now */
    currently, index to a semaphore set identifier now */
 typedef struct {
 typedef struct {
 	int semaphore_set;
 	int semaphore_set;
 	int semaphore_index;
 	int semaphore_index;
 } ser_lock_t;
 } ser_lock_t;
+#endif
+
 
 
 enum timer_groups {
 enum timer_groups {
 	TG_FR,
 	TG_FR,
@@ -26,7 +36,8 @@ enum timer_groups {
 	TG_NR
 	TG_NR
 };
 };
 
 
-extern ser_lock_t timer_group_lock[TG_NR];
+
+/* extern ser_lock_t timer_group_lock[TG_NR]; */
 
 
 
 
 #include "h_table.h"
 #include "h_table.h"
@@ -37,23 +48,30 @@ extern ser_lock_t timer_group_lock[TG_NR];
 
 
 
 
 int lock_initialize();
 int lock_initialize();
-static int init_semaphore_set( int size );
 void lock_cleanup();
 void lock_cleanup();
-
+/*
+#ifndef FAST_LOCK
+static int init_semaphore_set( int size );
+#endif
+*/
 
 
 #ifdef DBG_LOCK
 #ifdef DBG_LOCK
-int _lock( ser_lock_t s , char *file, char *function, unsigned int line );
-int _unlock( ser_lock_t s, char *file, char *function, unsigned int line );
-#	define lock(_s) _lock( (_s), __FILE__, __FUNCTION__, __LINE__ )
-#	define unlock(_s) _unlock( (_s), __FILE__, __FUNCTION__, __LINE__ )
+int _lock( ser_lock_t* s , char *file, char *function, unsigned int line );
+int _unlock( ser_lock_t* s, char *file, char *function, unsigned int line );
+#define lock(_s) _lock( (_s), __FILE__, __FUNCTION__, __LINE__ )
+#define unlock(_s) _unlock( (_s), __FILE__, __FUNCTION__, __LINE__ )
 #else
 #else
-int _lock( ser_lock_t s );
-int _unlock( ser_lock_t s );
-#	define lock(_s) _lock( (_s) )
-#	define unlock(_s) _unlock( (_s) )
+int _lock( ser_lock_t* s );
+int _unlock( ser_lock_t* s );
+#define lock(_s) _lock( (_s) )
+#define unlock(_s) _unlock( (_s) )
 #endif
 #endif
 
 
+/*
+#ifndef FAST_LOCK
 static int change_semaphore( ser_lock_t s  , int val );
 static int change_semaphore( ser_lock_t s  , int val );
+#endif
+*/
 
 
 int init_cell_lock( struct cell *cell );
 int init_cell_lock( struct cell *cell );
 int init_entry_lock( struct s_table* hash_table, struct entry *entry );
 int init_entry_lock( struct s_table* hash_table, struct entry *entry );

+ 11 - 8
modules/tm/t_funcs.c

@@ -51,20 +51,23 @@ inline void set_timer( struct s_table *hash_table,
 	add_to_tail_of_timer_list( &(hash_table->timers[ list_id ]),
 	add_to_tail_of_timer_list( &(hash_table->timers[ list_id ]),
 		new_tl,get_ticks()+timeout);
 		new_tl,get_ticks()+timeout);
 */
 */
-	lock(  list->mutex );
+	lock(&(list->mutex));
 	/* make sure I'm not already on a list */
 	/* make sure I'm not already on a list */
 	remove_timer_unsafe( new_tl );
 	remove_timer_unsafe( new_tl );
 	add_timer_unsafe( list, new_tl, get_ticks()+timeout);
 	add_timer_unsafe( list, new_tl, get_ticks()+timeout);
-	unlock( list->mutex );
+	unlock(&(list->mutex));
 }
 }
 
 
 /* remove from timer list */
 /* remove from timer list */
 inline void reset_timer( struct s_table *hash_table,
 inline void reset_timer( struct s_table *hash_table,
 	struct timer_link* tl )
 	struct timer_link* tl )
 {
 {
-	lock( timer_group_lock[ tl->tg ] );
+	/* lock(&(timer_group_lock[ tl->tg ])); */
+	/* hack to work arround this timer group thing*/
+	lock(&(hash_table->timers[timer_group[tl->tg]].mutex));
 	remove_timer_unsafe( tl );
 	remove_timer_unsafe( tl );
-	unlock( timer_group_lock[ tl->tg ] );
+	unlock(&(hash_table->timers[timer_group[tl->tg]].mutex));
+	/*unlock(&(timer_group_lock[ tl->tg ]));*/
 }
 }
 
 
 static inline void reset_retr_timers( struct s_table *h_table,
 static inline void reset_retr_timers( struct s_table *h_table,
@@ -76,23 +79,23 @@ static inline void reset_retr_timers( struct s_table *h_table,
 	DBG("DEBUG:stop_RETR_and_FR_timers : start \n");
 	DBG("DEBUG:stop_RETR_and_FR_timers : start \n");
 	/* lock the first timer list of the FR group -- all other
 	/* lock the first timer list of the FR group -- all other
 	   lists share the same lock*/
 	   lists share the same lock*/
-	lock(  hash_table->timers[RT_T1_TO_1].mutex );
+	lock(&(hash_table->timers[RT_T1_TO_1].mutex));
 	remove_timer_unsafe( & p_cell->outbound_response.retr_timer );
 	remove_timer_unsafe( & p_cell->outbound_response.retr_timer );
 	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
 	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
 			if ( rb = p_cell->outbound_request[ijk] ) {
 			if ( rb = p_cell->outbound_request[ijk] ) {
 				remove_timer_unsafe( & rb->retr_timer );
 				remove_timer_unsafe( & rb->retr_timer );
 			}
 			}
 		}
 		}
-	unlock(  hash_table->timers[RT_T1_TO_1].mutex );
+	unlock(&(hash_table->timers[RT_T1_TO_1].mutex));
 
 
-	lock(  hash_table->timers[FR_TIMER_LIST].mutex );
+	lock(&(hash_table->timers[FR_TIMER_LIST].mutex));
 	remove_timer_unsafe( & p_cell->outbound_response.fr_timer );
 	remove_timer_unsafe( & p_cell->outbound_response.fr_timer );
 	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
 	for( ijk=0 ; ijk<(p_cell)->nr_of_outgoings ; ijk++ )  {
 			if ( rb = p_cell->outbound_request[ijk] ) {
 			if ( rb = p_cell->outbound_request[ijk] ) {
 				remove_timer_unsafe( & rb->fr_timer );
 				remove_timer_unsafe( & rb->fr_timer );
 			}
 			}
 		}
 		}
-	unlock(  hash_table->timers[FR_TIMER_LIST].mutex );
+	unlock(&(hash_table->timers[FR_TIMER_LIST].mutex));
 	DBG("DEBUG:stop_RETR_and_FR_timers : stop\n");
 	DBG("DEBUG:stop_RETR_and_FR_timers : stop\n");
 }
 }
 
 

+ 6 - 6
modules/tm/t_funcs.h

@@ -33,10 +33,10 @@ extern struct s_table*  hash_table;
 #include "sip_msg.h"
 #include "sip_msg.h"
 
 
 
 
-#define LOCK_REPLIES(_t) lock((_t)->reply_mutex )
-#define UNLOCK_REPLIES(_t) unlock((_t)->reply_mutex )
-#define LOCK_ACK(_t) lock((_t)->ack_mutex )
-#define UNLOCK_ACK(_t) unlock((_t)->ack_mutex )
+#define LOCK_REPLIES(_t) lock(&((_t)->reply_mutex) )
+#define UNLOCK_REPLIES(_t) unlock(&((_t)->reply_mutex) )
+#define LOCK_ACK(_t) lock(&((_t)->ack_mutex) )
+#define UNLOCK_ACK(_t) unlock(&((_t)->ack_mutex) )
 
 
 
 
 /* convenience short-cut macros */
 /* convenience short-cut macros */
@@ -103,10 +103,10 @@ extern struct s_table*  hash_table;
 #ifdef _OLD_XX
 #ifdef _OLD_XX
 #define unref_T(_T_cell) \
 #define unref_T(_T_cell) \
 	( {\
 	( {\
-		lock( hash_table->entrys[(_T_cell)->hash_index].mutex );\
+		lock( &(hash_table->entrys[(_T_cell)->hash_index].mutex) );\
 		(_T_cell)->ref_counter--;\
 		(_T_cell)->ref_counter--;\
 		DBG_REF("unref", (_T_cell)); \
 		DBG_REF("unref", (_T_cell)); \
-		unlock( hash_table->entrys[(_T_cell)->hash_index].mutex );\
+		unlock( &(hash_table->entrys[(_T_cell)->hash_index].mutex) );\
 	} );
 	} );
 
 
 /* we assume that ref_T is only called from places where
 /* we assume that ref_T is only called from places where

+ 7 - 7
modules/tm/t_lookup.c

@@ -101,7 +101,7 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
 		p_msg->hash_index,isACK);
 		p_msg->hash_index,isACK);
 
 
 	/* lock the hole entry*/
 	/* lock the hole entry*/
-	lock( hash_table->entrys[p_msg->hash_index].mutex );
+	lock(&(hash_table->entrys[p_msg->hash_index].mutex));
 
 
 	/* all the transactions from the entry are compared */
 	/* all the transactions from the entry are compared */
 	p_cell     = hash_table->entrys[p_msg->hash_index].first_cell;
 	p_cell     = hash_table->entrys[p_msg->hash_index].first_cell;
@@ -162,7 +162,7 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
 	/* no transaction found */
 	/* no transaction found */
 	T = 0;
 	T = 0;
 	if (!leave_new_locked)
 	if (!leave_new_locked)
-		unlock( hash_table->entrys[p_msg->hash_index].mutex );
+		unlock(&(hash_table->entrys[p_msg->hash_index].mutex));
 	DBG("DEBUG: t_lookup_request: no transaction found\n");
 	DBG("DEBUG: t_lookup_request: no transaction found\n");
 	return -1;
 	return -1;
 
 
@@ -171,7 +171,7 @@ found:
 	T_REF( T );
 	T_REF( T );
 	DBG("DEBUG:XXXXXXXXXXXXXXXXXXXXX t_lookup_request: "
 	DBG("DEBUG:XXXXXXXXXXXXXXXXXXXXX t_lookup_request: "
 		"transaction found ( T=%p , ref=%x)\n",T,T->ref_bitmap);
 		"transaction found ( T=%p , ref=%x)\n",T,T->ref_bitmap);
-	unlock( hash_table->entrys[p_msg->hash_index].mutex );
+	unlock(&(hash_table->entrys[p_msg->hash_index].mutex));
 	return 1;
 	return 1;
 }
 }
 
 
@@ -312,7 +312,7 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch )
 	   hash_index, entry_label, branch_id );
 	   hash_index, entry_label, branch_id );
 
 
 	/* lock the hole entry*/
 	/* lock the hole entry*/
-	lock( hash_table->entrys[hash_index].mutex );
+	lock(&(hash_table->entrys[hash_index].mutex));
 
 
 	/*all the cells from the entry are scan to detect an entry_label matching */
 	/*all the cells from the entry are scan to detect an entry_label matching */
 	p_cell     = hash_table->entrys[hash_index].first_cell;
 	p_cell     = hash_table->entrys[hash_index].first_cell;
@@ -337,7 +337,7 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch )
 				T = p_cell;
 				T = p_cell;
 				*p_branch = branch_id;
 				*p_branch = branch_id;
 				T_REF( T );
 				T_REF( T );
-				unlock( hash_table->entrys[hash_index].mutex );
+				unlock(&(hash_table->entrys[hash_index].mutex));
 				DBG("DEBUG:XXXXXXXXXXXXXXXXXXXXX t_reply_matching:"
 				DBG("DEBUG:XXXXXXXXXXXXXXXXXXXXX t_reply_matching:"
 				  " reply matched (T=%p,ref=%x)!\n",T,T->ref_bitmap);
 				  " reply matched (T=%p,ref=%x)!\n",T,T->ref_bitmap);
 				return 1;
 				return 1;
@@ -350,7 +350,7 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch )
 	DBG("DEBUG: t_reply_matching: no matching transaction exists\n");
 	DBG("DEBUG: t_reply_matching: no matching transaction exists\n");
 
 
 nomatch:
 nomatch:
-	unlock( hash_table->entrys[hash_index].mutex );
+	unlock(&(hash_table->entrys[hash_index].mutex));
 nomatch2:
 nomatch2:
 	DBG("DEBUG: t_reply_matching: failure to match a transaction\n");
 	DBG("DEBUG: t_reply_matching: failure to match a transaction\n");
 	*p_branch = -1;
 	*p_branch = -1;
@@ -485,7 +485,7 @@ enum addifnew_status t_addifnew( struct sip_msg* p_msg )
 					T_REF(T);
 					T_REF(T);
 				}
 				}
 			}
 			}
-			unlock( hash_table->entrys[p_msg->hash_index].mutex );
+			unlock(&(hash_table->entrys[p_msg->hash_index].mutex));
 			return ret;
 			return ret;
 		} else {
 		} else {
 			/* tramsaction found, it's a retransmission  or ACK */
 			/* tramsaction found, it's a retransmission  or ACK */

+ 4 - 4
modules/tm/timer.c

@@ -63,7 +63,7 @@ void add_timer_unsafe( struct timer *timer_list,
 {
 {
 	/*	remove_from_timer_list( tl ); */
 	/*	remove_from_timer_list( tl ); */
 	/* the entire timer list is locked now -- noone else can manipulate it */
 	/* the entire timer list is locked now -- noone else can manipulate it */
-	/* lock( timer_list->mutex ); */
+	/* lock( &(timer_list->mutex) ); */
 	tl->time_out = time_out;
 	tl->time_out = time_out;
 	tl->prev_tl = timer_list->last_tl.prev_tl;
 	tl->prev_tl = timer_list->last_tl.prev_tl;
 	tl->next_tl = & timer_list->last_tl;
 	tl->next_tl = & timer_list->last_tl;
@@ -77,7 +77,7 @@ void add_timer_unsafe( struct timer *timer_list,
 		}
 		}
 #	endif
 #	endif
 	/* give the list lock away */
 	/* give the list lock away */
-	/* unlock( timer_list->mutex ); */
+	/* unlock( &(timer_list->mutex) ); */
 	DBG("DEBUG: add_to_tail_of_timer[%d]: %p\n",timer_list->id,tl);
 	DBG("DEBUG: add_to_tail_of_timer[%d]: %p\n",timer_list->id,tl);
 }
 }
 
 
@@ -95,7 +95,7 @@ struct timer_link  *check_and_split_time_list( struct timer *timer_list, int tim
 			return NULL;
 			return NULL;
 
 
 	/* the entire timer list is locked now -- noone else can manipulate it */
 	/* the entire timer list is locked now -- noone else can manipulate it */
-	lock( timer_list->mutex );
+	lock( &(timer_list->mutex) );
 
 
 	end = &timer_list->last_tl;
 	end = &timer_list->last_tl;
 	tl = timer_list->first_tl.next_tl;
 	tl = timer_list->first_tl.next_tl;
@@ -118,7 +118,7 @@ struct timer_link  *check_and_split_time_list( struct timer *timer_list, int tim
 	}
 	}
 
 
    /* give the list lock away */
    /* give the list lock away */
-   unlock( timer_list->mutex );
+   unlock( &(timer_list->mutex) );
 
 
    return ret;
    return ret;
 }
 }

+ 1 - 1
test/th-uri-2.cfg

@@ -22,7 +22,7 @@ rev_dns=yes      # (cmd. line: -R)
 #port=5070
 #port=5070
 #listen=127.0.0.1
 #listen=127.0.0.1
 #listen=192.168.57.33
 #listen=192.168.57.33
-listen=10.0.0.179
+#listen=10.0.0.179
 loop_checks=0
 loop_checks=0
 # for more info: sip_router -h
 # for more info: sip_router -h