The following commit has been merged in the master branch: commit 919d0cfed1af72a523c2013a0e5118b6ef6b5bc6 Author: Marek Lindner lindner_marek@yahoo.de Date: Sat Mar 10 14:36:11 2007 +0100
in client mode do not block SIGTERM
diff --git a/allocate.c b/allocate.c index cd43162..665cef3 100644 --- a/allocate.c +++ b/allocate.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h>
+#include "os.h" #include "allocate.h"
#define DEBUG_MALLOC @@ -142,12 +143,12 @@ void checkIntegrity(void)
struct memoryUsage *memoryWalker;
- fprintf( stderr, "Memory usage information:\n" ); + debug_output( 3, "Memory usage information:\n" );
for ( memoryWalker = memoryList; memoryWalker != NULL; memoryWalker = memoryWalker->next ) {
if ( memoryWalker->counter != 0 ) - fprintf( stderr, " tag: %''4i, num malloc: %''4i, bytes per malloc: %''4i, total: %''6i\n", memoryWalker->tag, memoryWalker->counter, memoryWalker->length, memoryWalker->counter * memoryWalker->length ); + debug_output( 3, " tag: %''4i, num malloc: % 4i, bytes per malloc: %''4i, total: % 6i\n", memoryWalker->tag, memoryWalker->counter, memoryWalker->length, memoryWalker->counter * memoryWalker->length );
}
diff --git a/orginator.c b/orginator.c index 6f3cae8..ca7ef82 100644 --- a/orginator.c +++ b/orginator.c @@ -207,9 +207,9 @@ void purge_orig( uint32_t curr_time ) { struct list_head *neigh_pos, *neigh_temp; struct list_head *gw_pos, *gw_pos_tmp; struct orig_node *orig_node; - struct neigh_node *neigh_node; + struct neigh_node *neigh_node, *best_neigh_node; struct gw_node *gw_node; - uint8_t gw_purged = 0; + uint8_t gw_purged = 0, neigh_purged = 0, max_packet_count; static char orig_str[ADDR_STR_LEN];
debug_output( 4, "purge() \n" ); @@ -264,6 +264,8 @@ void purge_orig( uint32_t curr_time ) {
} else {
+ max_packet_count = 0; + /* for all neighbours towards this orginator ... */ list_for_each_safe( neigh_pos, neigh_temp, &orig_node->neigh_list ) {
@@ -271,13 +273,27 @@ void purge_orig( uint32_t curr_time ) {
if ( (int)( ( neigh_node->last_aware + ( 2 * TIMEOUT ) ) < curr_time ) ) {
+ neigh_purged = 1; list_del( neigh_pos ); debugFree( neigh_node, 1404 );
+ } else { + + if ( neigh_node->packet_count > max_packet_count ) { + + max_packet_count = neigh_node->packet_count; + best_neigh_node = neigh_node; + + } + + }
}
+ if ( ( neigh_purged ) && ( ( orig_node->router == NULL ) || ( max_packet_count > orig_node->router->packet_count ) ) ) + update_routes( orig_node, best_neigh_node, orig_node->hna_buff, orig_node->hna_buff_len ); + }
} @@ -295,11 +311,11 @@ void purge_orig( uint32_t curr_time ) {
}
+ prof_stop( PROF_purge_orginator ); + if ( gw_purged ) choose_gw();
- prof_stop( PROF_purge_orginator ); - }
diff --git a/posix-specific.c b/posix-specific.c index 9da3559..3fd9dc8 100644 --- a/posix-specific.c +++ b/posix-specific.c @@ -578,6 +578,10 @@ void apply_init_args( int argc, char *argv[] ) { exit(EXIT_FAILURE); }
+ signal( SIGINT, handler ); + signal( SIGTERM, handler ); + signal( SIGSEGV, segmentation_fault ); + for ( res = 0; res < 4; res++ ) {
debug_clients.fd_list[res] = debugMalloc( sizeof(struct list_head), 204 ); diff --git a/posix.c b/posix.c index df46f58..82db1da 100644 --- a/posix.c +++ b/posix.c @@ -240,11 +240,6 @@ int main( int argc, char *argv[] ) { }
- signal( SIGINT, handler ); - signal( SIGTERM, handler ); - signal( SIGSEGV, segmentation_fault ); - - apply_init_args( argc, argv );
diff --git a/profile.c b/profile.c index 766e1ef..eb373b2 100644 --- a/profile.c +++ b/profile.c @@ -65,7 +65,7 @@ void prof_print() {
for ( index = 0; index < PROF_COUNT; index++ ) {
- debug_output( 3, " %''30s: cpu time = %10.3f, calls = %''4i\n", prof_container[index].name, (float)prof_container[index].total_time/CLOCKS_PER_SEC, prof_container[index].calls ); + debug_output( 3, " %''30s: cpu time = %10.3f, calls = %''6i\n", prof_container[index].name, (float)prof_container[index].total_time/CLOCKS_PER_SEC, prof_container[index].calls );
}