Clean accesslists every five minutes

dynamic-accesslists
Dirk Engling 2 years ago
parent be825f5759
commit f62398c748

@ -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 ) {

@ -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

@ -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;
}

Loading…
Cancel
Save