diff --git a/ot_accesslist.c b/ot_accesslist.c index 078cebd..2fc146c 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c @@ -369,6 +369,18 @@ void accesslist_deinit( void ) { pthread_cancel( thread_id ); pthread_mutex_destroy(&g_accesslist_mutex); } + +void accesslist_cleanup( void ) { + pthread_mutex_lock(&g_accesslist_mutex); + + accesslist_clean(g_accesslist); +#if WANT_DYNAMIC_ACCESSLIST + accesslist_clean(g_accesslist_add); + accesslist_clean(g_accesslist_delete); +#endif + + pthread_mutex_unlock(&g_accesslist_mutex); +} #endif int address_in_net( const ot_ip6 address, const ot_net *net ) { diff --git a/ot_accesslist.h b/ot_accesslist.h index e86969b..9280fcb 100644 --- a/ot_accesslist.h +++ b/ot_accesslist.h @@ -15,6 +15,7 @@ void accesslist_init( void ); void accesslist_deinit( void ); int accesslist_hashisvalid( ot_hash hash ); +void accesslist_cleanup( void ); extern char *g_accesslist_filename; #ifdef WANT_DYNAMIC_ACCESSLIST diff --git a/ot_clean.c b/ot_clean.c index 4c03416..139bedb 100644 --- a/ot_clean.c +++ b/ot_clean.c @@ -17,6 +17,7 @@ #include "ot_vector.h" #include "ot_clean.h" #include "ot_stats.h" +#include "ot_accesslist.h" /* Returns amount of removed peers */ static ssize_t clean_single_bucket( ot_peer *peers, size_t peer_count, time_t timedout, int *removed_seeders ) { @@ -123,6 +124,9 @@ static void * clean_worker( void * args ) { usleep( OT_CLEAN_SLEEP ); } stats_cleanup(); +#ifdef WANT_ACCESSLIST + accesslist_cleanup(); +#endif } return NULL; }