فهرست منبع

- updated Makefiles ( gcc-3.0 specific options, arch. specific defines section,
a.s.o)
- fixed gcc-3.0 warnings
- added f_malloc, an even faster malloc

Andrei Pelinescu-Onciul 23 سال پیش
والد
کامیت
b2dec9c60f
20فایلهای تغییر یافته به همراه193 افزوده شده و 84 حذف شده
  1. 9 1
      INSTALL
  2. 41 21
      Makefile.defs
  3. 8 5
      Makefile.rules
  4. 2 0
      Makefile.sources
  5. 1 1
      fastlock.h
  6. 13 5
      main.c
  7. 4 0
      mem/mem.c
  8. 14 1
      mem/mem.h
  9. 14 21
      mem/q_malloc.c
  10. 7 2
      mem/q_malloc.h
  11. 4 0
      mem/shm_mem.c
  12. 6 0
      mem/shm_mem.h
  13. 1 1
      modules/tm/config.h
  14. 43 3
      modules/tm/hash_func.c
  15. 3 2
      msg_parser.c
  16. 4 4
      parse_fline.c
  17. 1 1
      parse_via.c
  18. 7 5
      test/stateless.cfg
  19. 8 8
      test/th-uri.cfg
  20. 3 3
      udp_server.c

+ 9 - 1
INSTALL

@@ -15,7 +15,7 @@ Requirements:
 - flex
 - gmake (on Linux this is the standard "make")
 
-Arhitecture Notes:
+OS Notes:
 
 - FreeBSD: make sure gmake, bison & flex are installed
 - Solaris: as above; you can use Solaris's yacc instead of bison
@@ -56,6 +56,14 @@ make modules=modules/print modules
 
 make exclude_modules="CVS textops" modules
 
+-compile with the "tm" module statically linked and with profiling
+
+make static_modules=tm PROFILE=-pg all
+
+-compile with gcc-3.0 instead of gcc
+
+make CC=gcc-3.0 all
+
 
 
 Make targets:

+ 41 - 21
Makefile.defs

@@ -8,11 +8,12 @@
 #version number
 VERSION = 0
 PATCHLEVEL = 8
-SUBLEVEL = 5
+SUBLEVEL = 6
 EXTRAVERSION =
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
-ARCH = $(shell uname -s)
+OS = $(shell uname -s)
+ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ )
 
 # compile-time options
 #
@@ -47,15 +48,22 @@ ARCH = $(shell uname -s)
 # -DVQ_MALLOC
 #		additional option to PKG_MALLOC which utilizes a fater then
 #		qm version
+#		(not true anymore, q_malloc performs approx. the same)
+# -DF_MALLOC
+#		an even faster malloc, not recommended for debugging
 # -DDBG_MALLOC
 #		issues additional debugging information if lock/unlock is called
+# -DFAST_LOCK
+#		uses fast arhitecture specific locking (see the arh. specific section)
 #
 
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
+	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
-	 -DUSE_SYNONIM -DVQ_MALLOC\
-	 #-DFAST_LOCK -Di386
-	 #-DBRUT_HACK #-DEXTRA_DEBUG #-DSTATIC_TM
+	 -DUSE_SYNONIM \
+	 -DF_MALLOC
+	# -DVQ_MALLOC
+	 #-DBRUT_HACK #-DEXTRA_DEBUG 
 	#-DEXTRA_DEBUG -DBRUT_HACK \
 	#-DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
 	  #-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
@@ -67,31 +75,43 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 #-DNO_DEBUG#-DSTATS -DNO_DEBUG
 #-DNO_LOG
 
-PROFILE=  -pg #set this if you want profiling
-mode = debug
-#mode = release
+# arh. specific definitions
+ifeq ($(ARCH), i386)
+	DEFS+= -DFAST_LOCK
+endif
+
+
+#PROFILE=  -pg #set this if you want profiling
+#mode = debug
+mode = release
 
 # platform dependent settings
 
 
 #common
 CC=gcc
-LD=gcc
+LD= $(CC)
+CC_VER= $(CC) $(shell $(CC) --version)
 MKDEP=gcc -MM $(DEFS)
 MKTAGS=ctags -R .
 
 ifeq ($(mode), release)
-	CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
-#			-malign-double -malign-loops=4 -minline-all-stringops \
-#			-march=athlon -mcpu=athlon
-	#-Wmissing-prototypes
-	LDFLAGS=-Wl,-O2 -Wl,-E $(PROFILE)
+	CFLAGS+=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
+			-malign-double -malign-loops=4
+			#-Wmissing-prototypes \
+	
+ifneq (,$(findstring 3.0, $(CC_VER)))
+	CFLAGS+=-minline-all-stringops \
+				-march=athlon \
+				#-mcpu=athlon
+endif
+	LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
 	# we need -fPIC -DPIC only for shared objects, we don't need them for
 	# the executable file, because it's always loaded at a fixed address
 	# -andrei
 else
-	CFLAGS=-g -Wcast-align -Winline $(PROFILE)
-	LDFLAGS=-g -Wl,-E $(PROFILE)
+	CFLAGS+=-g -Wcast-align -Winline $(PROFILE)
+	LDFLAGS+=-g -Wl,-E $(PROFILE)
 endif
 
 #*FLAGS used for compiling the modules
@@ -107,10 +127,10 @@ LIBS=-lfl -ldl
 
 
 #arch specific stuff
-ifeq ($(ARCH), Linux)
+ifeq ($(OS), Linux)
 
 endif
-ifeq  ($(ARCH), SunOS)
+ifeq  ($(OS), SunOS)
 	ifeq ($(mode), release)
 		LDFLAGS=-O2 $(PROFILE)
 		MOD_LDFLAGS=-O2 -G
@@ -118,18 +138,18 @@ ifeq  ($(ARCH), SunOS)
 		LDFLAGS=-g $(PROFILE)
 		MOD_LDFLAGS=-g -G
 	endif
-	
+
 YACC=yacc
 LIBS+=-L/usr/local/lib -lxnet # or -lnsl -lsocket or -lglibc ?
 
 endif
-ifeq ($(ARCH), FreeBSD)
+ifeq ($(OS), FreeBSD)
 
 YACC=yacc
 LIBS= -lfl  #dlopen is in libc
 
 endif
-ifneq (,$(findstring CYGWIN, $(ARCH)))
+ifneq (,$(findstring CYGWIN, $(OS)))
 
 #cygwin is the same as common
 

+ 8 - 5
Makefile.rules

@@ -6,7 +6,8 @@
 #
 
 #
-# Uses: NAME, ALLDEP, CC, CFLAGS, DEFS, LIBS, MKDEP, auto_gen, depends, objs
+# Uses: NAME, ALLDEP, CC, CFLAGS, DEFS, LIBS, MKDEP, auto_gen, depends, objs,
+# extra_objs, static_modules, static_modules_path
 # (all this must  be defined previously!,  see Makefile.defs & Makefile)
 #
 
@@ -38,8 +39,10 @@ static: $(objs)
 
 .PHONY: clean
 clean:
-	-@rm $(objs) $(NAME) 2>/dev/null
-	-@for r in $(modules); do $(MAKE) -C $$r clean ; done
+	-@rm -f $(objs) $(NAME) 2>/dev/null
+	-@for r in $(modules) $(static_modules_path); do \
+		$(MAKE) -C $$r clean ; \
+	done
 
 
 
@@ -47,12 +50,12 @@ clean:
 .PHONY: distclean
 .PHONY: realclean
 proper realclean distclean: clean 
-	-@rm $(depends) 2>/dev/null
+	-@rm -f $(depends) 2>/dev/null
 	-@for r in $(modules); do $(MAKE) -C $$r proper ; done
 
 .PHONY: mantainer-cleaan
 mantainer-clean: distclean
-	-rm $(auto_gen) TAGS tags *.dbg .*.swp
+	-rm -f $(auto_gen) TAGS tags *.dbg .*.swp
 	-@for r in $(modules); do $(MAKE) -C $$r mantainer-clean ; done
 
 .PHONY: TAGS

+ 2 - 0
Makefile.sources

@@ -16,3 +16,5 @@ objs=$(sources:.c=.o)
 extra_objs=
 depends=$(sources:.c=.d)
 modules=
+static_modules=
+static_modules_path=

+ 1 - 1
fastlock.h

@@ -15,7 +15,7 @@
 #include <sched.h>
 
 
-#ifdef i386
+#ifdef __i386
 
 
 typedef  volatile int lock_t;

+ 13 - 5
main.c

@@ -41,7 +41,7 @@
 #endif
 
 static char id[]="@(#) $Id$";
-static char version[]=  NAME " " VERSION " (" ARCH ")" ;
+static char version[]=  NAME " " VERSION " (" ARCH "/" OS ")" ;
 static char compiled[]= __TIME__ __DATE__ ;
 static char flags[]=
 "STATS:"
@@ -74,6 +74,9 @@ static char flags[]=
 #ifdef VQ_MALLOC
 ", VQ_MALLOC"
 #endif
+#ifdef F_MALLOC
+", F_MALLOC"
+#endif
 #ifdef USE_SHM_MEM
 ", USE_SHM_MEM"
 #endif
@@ -83,6 +86,9 @@ static char flags[]=
 #ifdef DEBUG_DMALLOC
 ", DEBUG_DMALLOC"
 #endif
+#ifdef FAST_LOCK
+", FAST_LOCK"
+#endif
 ;
 
 static char help_msg[]= "\
@@ -537,7 +543,9 @@ int main(int argc, char** argv)
 					printf("flags: %s\n", flags );
 					print_ct_constants();
 					printf("%s\n",id);
-					printf("%s compiled on %s at %s\n", __FILE__, __DATE__, __TIME__ );
+					printf("%s compiled on %s at %s with %s\n", __FILE__,
+							__DATE__, __TIME__, COMPILER );
+					
 					exit(0);
 					break;
 			case 'h':
@@ -647,15 +655,15 @@ int main(int argc, char** argv)
 	if (working_dir==0) working_dir="/";
 	/*alloc pids*/
 #ifdef SHM_MEM
-	pids=shm_malloc(sizeof(int)*children_no);
+	pids=shm_malloc(sizeof(int)*(children_no+1));
 #else
-	pids=malloc(sizeof(int)*children_no);
+	pids=malloc(sizeof(int)*(children_no+1));
 #endif
 	if (pids==0){
 		fprintf(stderr, "ERROR: out  of memory\n");
 		goto error;
 	}
-	memset(pids, 0, sizeof(int)*children_no);
+	memset(pids, 0, sizeof(int)*(children_no+1));
 
 	if (addresses_no==0) {
 		/* get our address, only the first one */

+ 4 - 0
mem/mem.c

@@ -18,6 +18,8 @@
 	char mem_pool[PKG_MEM_POOL_SIZE];
 	#ifdef VQ_MALLOC
 		struct vqm_block* mem_block;
+	#elif defined F_MALLOC
+		struct fm_block* mem_block;
 	#else
 		struct qm_block* mem_block;
 	#endif
@@ -29,6 +31,8 @@ int init_mallocs()
         /*init mem*/
 	#ifdef VQ_MALLOC
         	mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
+	#elif F_MALLOC
+		mem_block=fm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
 	#else
         	mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
 	#endif

+ 14 - 1
mem/mem.h

@@ -14,7 +14,10 @@
 #	ifdef VQ_MALLOC
 #		include "vq_malloc.h"
 		extern struct vqm_block* mem_block;
-#	else
+#	elif defined F_MALLOC
+#		include "f_malloc.h"
+		extern struct fm_block* mem_block;
+#   else
 #		include "q_malloc.h"
 		extern struct qm_block* mem_block;
 #	endif
@@ -28,6 +31,11 @@
 				__FUNCTION__, __LINE__);
 #			define pkg_free(p)   vqm_free(mem_block, (p), __FILE__,  \
 				__FUNCTION__, __LINE__);
+#		elif defined F_MALLOC
+#			define pkg_malloc(s) fm_malloc(mem_block, (s),__FILE__, \
+				__FUNCTION__, __LINE__);
+#			define pkg_free(p)   fm_free(mem_block, (p), __FILE__,  \
+				__FUNCTION__, __LINE__);
 #		else
 #			define pkg_malloc(s) qm_malloc(mem_block, (s),__FILE__, \
 				__FUNCTION__, __LINE__);
@@ -38,6 +46,9 @@
 #		ifdef VQ_MALLOC
 #			define pkg_malloc(s) vqm_malloc(mem_block, (s))
 #			define pkg_free(p)   vqm_free(mem_block, (p))
+#		elif defined F_MALLOC
+#			define pkg_malloc(s) fm_malloc(mem_block, (s))
+#			define pkg_free(p)   fm_free(mem_block, (p))
 #		else
 #			define pkg_malloc(s) qm_malloc(mem_block, (s))
 #			define pkg_free(p)   qm_free(mem_block, (p))
@@ -45,6 +56,8 @@
 #	endif
 #	ifdef VQ_MALLOC
 #		define pkg_status()  vqm_status(mem_block)
+#	elif defined F_MALLOC
+#		define pkg_status()  fm_status(mem_block)
 #	else
 #		define pkg_status()  qm_status(mem_block)
 #	endif

+ 14 - 21
mem/q_malloc.c

@@ -2,7 +2,7 @@
  *
  */
 
-#if !defined(q_malloc) && !(defined VQ_MALLOC)
+#if !defined(q_malloc) && !(defined VQ_MALLOC) && !(defined F_MALLOC)
 #define q_malloc
 
 #include "q_malloc.h"
@@ -130,7 +130,7 @@ struct qm_block* qm_malloc_init(char* address, unsigned int size)
 	if (size <(MIN_FRAG_SIZE+FRAG_OVERHEAD)) return 0;
 	size=ROUNDDOWN(size);
 	
-	init_overhead=sizeof(struct qm_block)+sizeof(struct qm_frag)+
+	init_overhead=ROUNDUP(sizeof(struct qm_block))+sizeof(struct qm_frag)+
 		sizeof(struct qm_frag_end);
 	printf("qm_malloc_init: size= %d, init_overhead=%d\n", size, init_overhead);
 	
@@ -147,7 +147,7 @@ struct qm_block* qm_malloc_init(char* address, unsigned int size)
 	qm->real_used=init_overhead;
 	qm->max_real_used=qm->real_used;
 	
-	qm->first_frag=(struct qm_frag*)(start+sizeof(struct qm_block));
+	qm->first_frag=(struct qm_frag*)(start+ROUNDUP(sizeof(struct qm_block)));
 	qm->last_frag_end=(struct qm_frag_end*)(end-sizeof(struct qm_frag_end));
 	/* init initial fragment*/
 	qm->first_frag->size=size;
@@ -240,9 +240,8 @@ void* qm_malloc(struct qm_block* qm, unsigned int size)
 	/*size must be a multiple of 8*/
 	size=ROUNDUP(size);
 	if (size>(qm->size-qm->real_used)) return 0;
-	/*search for a suitable free frag*/
-	f=qm_find_free(qm, size);
 
+	/*search for a suitable free frag*/
 	if ((f=qm_find_free(qm, size))!=0){
 		/* we found it!*/
 		/*detach it from the free list*/
@@ -339,7 +338,6 @@ void qm_free(struct qm_block* qm, void* p)
 	DBG("qm_free: freeing block alloc'ed from %s: %s(%d)\n", f->file, f->func,
 			f->line);
 #endif
-	next=FRAG_NEXT(f);
 	size=f->size;
 	qm->used-=size;
 	qm->real_used-=size;
@@ -349,7 +347,7 @@ void qm_free(struct qm_block* qm, void* p)
 
 #ifdef QM_JOIN_FREE
 	/* join packets if possible*/
-
+	next=FRAG_NEXT(f);
 	if (((char*)next < (char*)qm->last_frag_end) &&( next->u.is_free)){
 		/* join */
 		qm_detach_free(qm, next);
@@ -399,32 +397,27 @@ void qm_status(struct qm_block* qm)
 			qm->used, qm->real_used, qm->size-qm->real_used);
 	LOG(L_INFO, " max used (+overhead)= %d\n", qm->max_real_used);
 	
-	LOG(L_INFO, "dumping all fragments:\n");
+	LOG(L_INFO, "dumping all allocked. fragments:\n");
 	for (f=qm->first_frag, i=0;(char*)f<(char*)qm->last_frag_end;f=FRAG_NEXT(f)
 			,i++){
-		LOG(L_INFO, "    %3d. %c  address=%x  size=%d\n", i, 
+		if (! f->u.is_free){
+			LOG(L_INFO, "    %3d. %c  address=%x  size=%d\n", i, 
 				(f->u.is_free)?'a':'N',
 				(char*)f+sizeof(struct qm_frag), f->size);
 #ifdef DBG_QM_MALLOC
-		LOG(L_INFO, "            %s from %s: %s(%d)\n",
+			LOG(L_INFO, "            %s from %s: %s(%d)\n",
 				(f->u.is_free)?"freed":"alloc'd", f->file, f->func, f->line);
-		LOG(L_INFO, "        start check=%x, end check= %x, %x\n",
+			LOG(L_INFO, "        start check=%x, end check= %x, %x\n",
 				f->check, FRAG_END(f)->check1, FRAG_END(f)->check2);
 #endif
+		}
 	}
-	LOG(L_INFO, "dumping free list:\n");
+	LOG(L_INFO, "dumping free list stats :\n");
 	for(h=0,i=0;h<QM_HASH_SIZE;h++){
 		
 		for (f=qm->free_hash[h].head.u.nxt_free,j=0; 
-				f!=&(qm->free_hash[h].head); f=f->u.nxt_free, i++, j++){
-			LOG(L_INFO, "   %5d.[%3d:%3d] %c  address=%x  size=%d\n", i, h, j,
-					(f->u.is_free)?'a':'N',
-					(char*)f+sizeof(struct qm_frag), f->size);
-#ifdef DBG_QM_MALLOC
-			DBG("            %s from %s: %s(%d)\n", 
-				(f->u.is_free)?"freed":"alloc'd", f->file, f->func, f->line);
-#endif
-		}
+				f!=&(qm->free_hash[h].head); f=f->u.nxt_free, i++, j++);
+		if (j) LOG(L_INFO, "hash= %3d. fragments no.: %5d\n", h, j);
 	}
 	LOG(L_INFO, "-----------------------------\n");
 }

+ 7 - 2
mem/q_malloc.h

@@ -3,14 +3,17 @@
  * simple & fast malloc library
  */
 
-#if !defined(q_malloc_h) && !defined(VQ_MALLOC)
+#if !defined(q_malloc_h) && !defined(VQ_MALLOC) && !defined(F_MALLOC)
 #define q_malloc_h
 
 
 
 /* defs*/
 
-#define ROUNDTO		16 /* size we round to, must be = 2^n */
+#define ROUNDTO		16 /* size we round to, must be = 2^n  and also
+						 sizeof(qm_frag)+sizeof(qm_frag_end)
+						 must be mutliple of ROUNDTO!
+					   */
 #define MIN_FRAG_SIZE	ROUNDTO
 
 
@@ -47,6 +50,8 @@ struct qm_frag_end{
 #ifdef DBG_QM_MALLOC
 	unsigned int check1;
 	unsigned int check2;
+	unsigned int reserved1;
+	unsigned int reserved2;
 #endif
 	unsigned int size;
 	struct qm_frag* prev_free;

+ 4 - 0
mem/shm_mem.c

@@ -51,6 +51,8 @@ int shm_semid=-1; /*semaphore id*/
 static void* shm_mempool=(void*)-1;
 #ifdef VQ_MALLOC
 	struct vqm_block* shm_block;
+#elif F_MALLOC
+	struct fm_block* shm_block;
 #else
 	struct qm_block* shm_block;
 #endif
@@ -184,6 +186,8 @@ int shm_mem_init()
 	/* init it for malloc*/
 #	ifdef VQ_MALLOC
 		shm_block=vqm_malloc_init(shm_mempool, SHM_MEM_SIZE);
+	#elif defined F_MALLOC
+		shm_block=fm_malloc_init(shm_mempool, SHM_MEM_SIZE);
 #	else
 		shm_block=qm_malloc_init(shm_mempool, SHM_MEM_SIZE);
 #	endif

+ 6 - 0
mem/shm_mem.h

@@ -33,6 +33,12 @@
 #	define MY_MALLOC vqm_malloc
 #	define MY_FREE vqm_free
 #	define MY_STATUS vqm_status
+#elif defined F_MALLOC
+#	include "f_malloc.h"
+	extern struct fm_block* shm_block;
+#	define MY_MALLOC fm_malloc
+#	define MY_FREE fm_free
+#	define MY_STATUS fm_status
 #else
 #	include "q_malloc.h"
 	extern struct qm_block* shm_block;

+ 1 - 1
modules/tm/config.h

@@ -8,7 +8,7 @@
 
 /* always use a power of 2 for hash table size */
 #define T_TABLE_POWER		12
-#define TABLE_ENTRIES  		(2 << (T_TABLE_POWER-1))
+#define TABLE_ENTRIES  		(1 << (T_TABLE_POWER))
 
 /* maximum number of forks per transaction */
 #define MAX_FORK		2

+ 43 - 3
modules/tm/hash_func.c

@@ -22,12 +22,52 @@ int old_hash( str  call_id, str cseq_nr )
 {
    int  hash_code = 0;
    int  i;
+	
+#ifdef i386
+   int ci_len, cs_len;
+   char *ci, *cs;
+   
+	trim_len( ci_len, ci, call_id );
+	trim_len( cs_len, cs, cseq_nr );
+
+		int dummy1;
+		if (call_id.len>=4){
+			asm(
+				"1: \n\r"
+				"addl (%1), %0 \n\r"
+				"add $4, %1 \n\r"
+				"cmp %2, %1 \n\r"
+				"jl 1b  \n\r"
+				: "=r"(hash_code), "=r"(dummy1)
+				:  "0" (hash_code), "1"(ci),
+				"r"( (ci_len & (~3)) +ci)
+			);
+		}
+#else
     if ( call_id.len>0 )
       for( i=0 ; i<call_id.len ; hash_code+=call_id.s[i++]  );
+#endif
+
+#ifdef i386
+
+		int dummy2;
+		if (cseq_nr.len>=4){
+			asm(
+				"1: \n\r"
+				"addl (%1), %0 \n\r"
+				"add $4, %1 \n\r"
+				"cmp %2, %1 \n\r"
+				"jl 1b  \n\r"
+				: "=r"(hash_code), "=r"(dummy2)
+				:  "0" (hash_code), "1"(cs),
+				"r"((cs_len & (~3) )+ cs)
+			);
+		}
+#else
     if ( cseq_nr.len>0 )
       for( i=0 ; i<cseq_nr.len ; hash_code+=cseq_nr.s[i++] );
-
-   return hash_code %= TABLE_ENTRIES;
+#endif
+   return hash_code &= (TABLE_ENTRIES-1); /* TABLE_ENTRIES = 2^k */
 }
 
 int new_hash( str call_id, str cseq_nr )
@@ -64,7 +104,7 @@ int new_hash( str call_id, str cseq_nr )
 		//hash_code+=crc_32_tab[(cseq_nr.s[i]+hash_code)%243];
 		hash_code+=ccitt_tab[*(cs+i)+123];
 
-	hash_code %= (TABLE_ENTRIES-1);
+	hash_code &= (TABLE_ENTRIES-1); /* TABLE_ENTRIES = 2^k */
    	return hash_code;
 }
 

+ 3 - 2
msg_parser.c

@@ -69,7 +69,7 @@ char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl)
 	} else IFISMETHOD( INVITE, 'I' )
 	else IFISMETHOD( CANCEL, 'C')
 	else IFISMETHOD( ACK, 'A' )
-	else IFISMETHOD( BYE, 'B' )
+	else IFISMETHOD( BYE, 'B' ) 
 	/* if you want to add another method XXX, include METHOD_XXX in
            H-file (this is the value which you will take later in
            processing and define XXX_LEN as length of method name;
@@ -379,6 +379,7 @@ char * parse_cseq(char *buf, char* end, struct cseq_body* cb)
 		}
 		t++;
 check_continue:
+		;
 	}while( (t<end) && ((*t==' ')||(*t=='\t')) );
 
 	cb->error=PARSE_OK;
@@ -857,7 +858,7 @@ void free_sip_msg(struct sip_msg* msg)
 	pkg_free(msg->orig);
 	/* don't free anymore -- now a pointer to a static buffer */
 #	ifdef DYN_BUF
-	pkg_free(msg->buf); */
+	pkg_free(msg->buf); 
 #	endif
 }
 

+ 4 - 4
parse_fline.c

@@ -991,8 +991,8 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
 						state=F_CR;
 						break;
 					default:
-						LOG(L_ERR, "ERROR: parse_first_line: invalid
-								message\n");
+						LOG(L_ERR, "ERROR: parse_first_line: invalid" 
+								"message\n");
 						goto error;
 				}
 				break;
@@ -1015,8 +1015,8 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
 						state=F_LF;
 						goto skip;
 					default:
-						LOG(L_ERR, "ERROR: parse_first_line: invalid
-								message\n");
+						LOG(L_ERR, "ERROR: parse_first_line: invalid"
+								" message\n");
 						goto error;
 				}
 				break;

+ 1 - 1
parse_via.c

@@ -68,7 +68,7 @@ enum{	L_VALUE=200,   F_VALUE, P_VALUE, P_STRING,
  * state=F_{LF,CR,CRLF}!
  * output state = L_PARAM or F_PARAM or END_OF_HEADER
  * (and saved_state= last state); everything else => error */
-__inline char* parse_via_param(	char* p, char* end, int* pstate,
+char* parse_via_param(	char* p, char* end, int* pstate, 
 								int* psaved_state, struct via_param* param)
 {
 	char* tmp;

+ 7 - 5
test/stateless.cfg

@@ -7,17 +7,19 @@
 
 debug=3          # debug level (cmd line: -dddddddddd)
 #fork=yes          # (cmd. line: -D)
-fork=no
+fork=yes
+#fork=no
 log_stderror=yes # (cmd line: -E)
 #log_stderror=no	# (cmd line: -E)
 
 
-children=8
+children=4
 check_via=no     # (cmd. line: -v)
-dns=on           # (cmd. line: -r)
-rev_dns=yes      # (cmd. line: -R)
+dns=off           # (cmd. line: -r)
+rev_dns=off      # (cmd. line: -R)
 #port=5070
-listen=127.0.0.1
+listen=10.0.0.179
+#listen=127.0.0.1
 #listen=192.168.57.33
 loop_checks=0
 # for more info: sip_router -h

+ 8 - 8
test/th-uri.cfg

@@ -5,19 +5,19 @@
 #
 
 
-debug=9          # debug level (cmd line: -dddddddddd)
-#fork=yes          # (cmd. line: -D)
-fork=no
+debug=3          # debug level (cmd line: -dddddddddd)
+fork=yes          # (cmd. line: -D)
+#fork=no
 log_stderror=yes # (cmd line: -E)
 #log_stderror=no	# (cmd line: -E)
 
 
-children=8
+children=4
 check_via=no     # (cmd. line: -v)
-dns=on           # (cmd. line: -r)
-rev_dns=yes      # (cmd. line: -R)
+dns=off           # (cmd. line: -r)
+rev_dns=off      # (cmd. line: -R)
 #port=5070
-#listen=127.0.0.1
+listen=10.0.0.179
 #listen=192.168.57.33
 loop_checks=0
 # for more info: sip_router -h
@@ -25,7 +25,7 @@ loop_checks=0
 #modules
 #loadmodule "modules/print/print.so"
 loadmodule "modules/tm/tm.so"
-loadmodule "modules/rr/rr.so"
+#loadmodule "modules/rr/rr.so"
 loadmodule "modules/maxfwd/maxfwd.so"
 
 

+ 3 - 3
udp_server.c

@@ -154,7 +154,7 @@ int udp_rcv_loop()
 #ifdef DYN_BUF
 	char* buf;
 #else
-	char buf [BUF_SIZE+1];
+	static char buf [BUF_SIZE+1];
 #endif
 
 	struct sockaddr* from;
@@ -181,7 +181,7 @@ int udp_rcv_loop()
 		if (len==-1){
 			LOG(L_ERR, "ERROR: udp_rcv_loop:recvfrom: %s\n",
 						strerror(errno));
-			if (errno==EINTR)	goto skip;
+			if (errno==EINTR)	continue; /* goto skip;*/
 			else goto error;
 		}
 		/*debugging, make print* msg work */
@@ -190,7 +190,7 @@ int udp_rcv_loop()
 		/* receive_msg must free buf too!*/
 		receive_msg(buf, len, ((struct sockaddr_in*)from)->sin_addr.s_addr);
 		
-	skip: /* do other stuff */
+	/* skip: do other stuff */
 		
 	}