Browse Source

- logstderror works now with more than 1 process
- played a little with the locks

Andrei Pelinescu-Onciul 24 years ago
parent
commit
676924fb0c
7 changed files with 26 additions and 21 deletions
  1. 1 1
      Makefile.defs
  2. 1 1
      config.h
  3. 6 5
      main.c
  4. 1 1
      modules/tm/h_table.c
  5. 1 0
      modules/tm/lock.c
  6. 10 7
      modules/tm/t_funcs.c
  7. 6 6
      t_debug.cfg

+ 1 - 1
Makefile.defs

@@ -46,7 +46,7 @@ ARCH = $(shell uname -s)
 #		malloc etc.)
 DEFS= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
-	 -DNO_DEBUG -DDBG_QM_MALLOC 
+	 -DDBG_QM_MALLOC #-DNO_DEBUG #
 #-DEXTRA_DEBUG
 # -DUSE_SHM_MEM
 #-DNO_DEBUG 

+ 1 - 1
config.h

@@ -48,7 +48,7 @@
 #define PKG_MEM_POOL_SIZE 1024*1024
 
 /*used is SH_MEM is defined*/
-#define SHM_MEM_SIZE 8*1024*1024
+#define SHM_MEM_SIZE 128*1024*1024
 
 #define TIMER_TICK 1
 #define LONG_SLEEP	3600

+ 6 - 5
main.c

@@ -223,10 +223,11 @@ int daemonize(char*  name)
 	}
 	
 	/* close any open file descriptors */
-	for (r=0;r<MAX_FD; r++){
-		if ((r==3) && log_stderr)  continue;
-		close(r);
-	}
+	if (log_stderr==0)
+		for (r=0;r<MAX_FD; r++){
+			if ((r==3) && log_stderr)  continue;
+			close(r);
+		}
 	return  0;
 
 error:
@@ -286,7 +287,7 @@ int main_loop()
 					return udp_rcv_loop();
 				}
 			}
-			close(udp_sock); /*parent*/
+			/*close(udp_sock);*/ /*parent*/
 		}
 	}
 	/*this is the main process*/

+ 1 - 1
modules/tm/h_table.c

@@ -257,7 +257,7 @@ void ref_cell( struct cell* p_cell)
 {
    lock( p_cell->mutex );
    p_cell->ref_counter++;
-   unlock( p_cell->mutex );
+  unlock( p_cell->mutex );
 }
 
 

+ 1 - 0
modules/tm/lock.c

@@ -172,6 +172,7 @@ void lock_cleanup()
 
 }
 
+
 /* lock sempahore s */
 int lock( ser_lock_t s )
 {

+ 10 - 7
modules/tm/t_funcs.c

@@ -33,13 +33,15 @@
 
 
 #define insert_into_timer(hash_table,new_tl,list_id,time_out) \
-	insert_into_timer_list(hash_table,new_tl,list_id,(get_ticks()+time_out))
+	insert_into_timer_list((hash_table), (new_tl), (list_id), \
+			(get_ticks()+(time_out)))
 
 #define add_to_tail_of_timer(hash_table,new_tl,list_id,time_out) \
-	add_to_tail_of_timer_list(hash_table,new_tl,list_id,(get_ticks()+time_out))
+	add_to_tail_of_timer_list((hash_table), (new_tl), (list_id), \
+			(get_ticks()+(time_out)))
 
 #define remove_from_timer(hash_table,tl,list_id) \
-	remove_from_timer_list( hash_table , tl , list_id)\
+	remove_from_timer_list( (hash_table), (tl) , (list_id))
 
 
 
@@ -59,9 +61,9 @@ int tm_startup()
 
    /* installing handlers for timers */
    hash_table->timers[RETRASMISSIONS_LIST].timeout_handler = retransmission_handler;
-   hash_table->timers[FR_TIMER_LIST].timeout_handler              = final_response_handler;
-   hash_table->timers[WT_TIMER_LIST].timeout_handler             = wait_handler;
-   hash_table->timers[DELETE_LIST].timeout_handler                 = delete_handler;
+   hash_table->timers[FR_TIMER_LIST].timeout_handler = final_response_handler;
+   hash_table->timers[WT_TIMER_LIST].timeout_handler = wait_handler;
+   hash_table->timers[DELETE_LIST].timeout_handler = delete_handler;
 
    /* register the timer function */
    register_timer( timer_routine , hash_table , 1 );
@@ -100,7 +102,8 @@ void tm_shutdown()
     /* destroy the hash table */
     DBG("DEBUG: tm_shutdown : empting hash table\n");
     free_hash_table( hash_table );
-
+    DBG("DEBUG: tm_shutdown : removing semaphores\n");
+	lock_cleanup();
     DBG("DEBUG: tm_shutdown : done\n");
 }
 

+ 6 - 6
t_debug.cfg

@@ -2,11 +2,11 @@ debug=9          # debug level (cmd line: -dddddddddd)
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)
 rev_dns=yes      # (cmd. line: -R)
-fork=no          # (cmd. line: -D)
-#children=4
+fork=yes          # (cmd. line: -D)
+children=4
 log_stderror=yes # (cmd line: -E)
 #port=5080
-#listen=127.0.0.1
+listen=127.0.0.1
 loop_checks=1
 # for more info: sip_router -h
 
@@ -24,7 +24,7 @@ route{
 	if ( t_lookup_request()) {
 		if ( method=="ACK" )	{
 			log("SER: ACK received -> t_release\n");
-			if (! t_forward("195.37.78.233", "6666" )) {
+			if (! t_forward("127.0.0.1", "5090" )) {
 				log("SER: WARNING: bad forward\n");
 			};
 			if (! t_release()) {
@@ -58,12 +58,12 @@ route{
 		#t_forward("benetnash.fokus.gmd.de", "5080" );
 		if (method=="BYE") {
 			log("SER: BYE received, HACK: forwarding to client\n");
-			if (! t_forward("195.37.78.233", "5555")){
+			if (! t_forward("127.0.0.1", "5000")){
 				log("SER:ERROR: t_forward (..., 5555)\n");
 			};
 
 		}else{
-			if (! t_forward("195.37.78.233", "6666" )){
+			if (! t_forward("127.0.0.1", "5090" )){
 				log("SER:ERROR: t_forward (..., 6666)\n");
 			};
 		};