diff options
-rw-r--r-- | ot_clean.c | 2 | ||||
-rw-r--r-- | ot_stats.c | 8 | ||||
-rw-r--r-- | ot_stats.h | 1 |
3 files changed, 11 insertions, 0 deletions
@@ -16,6 +16,7 @@ | |||
16 | #include "ot_mutex.h" | 16 | #include "ot_mutex.h" |
17 | #include "ot_vector.h" | 17 | #include "ot_vector.h" |
18 | #include "ot_clean.h" | 18 | #include "ot_clean.h" |
19 | #include "ot_stats.h" | ||
19 | 20 | ||
20 | /* Returns amount of removed peers */ | 21 | /* Returns amount of removed peers */ |
21 | static ssize_t clean_single_bucket( ot_peer *peers, size_t peer_count, time_t timedout, int *removed_seeders ) { | 22 | static ssize_t clean_single_bucket( ot_peer *peers, size_t peer_count, time_t timedout, int *removed_seeders ) { |
@@ -121,6 +122,7 @@ static void * clean_worker( void * args ) { | |||
121 | return NULL; | 122 | return NULL; |
122 | usleep( OT_CLEAN_SLEEP ); | 123 | usleep( OT_CLEAN_SLEEP ); |
123 | } | 124 | } |
125 | stats_cleanup(); | ||
124 | } | 126 | } |
125 | return NULL; | 127 | return NULL; |
126 | } | 128 | } |
@@ -731,6 +731,14 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uintptr_t event | |||
731 | } | 731 | } |
732 | } | 732 | } |
733 | 733 | ||
734 | void stats_cleanup() { | ||
735 | #ifdef WANT_SPOT_WOODPECKER | ||
736 | pthread_mutex_lock( &g_woodpeckers_mutex ); | ||
737 | stats_shift_down_network_count( &stats_woodpeckers_tree, 0, 1 ); | ||
738 | pthread_mutex_unlock( &g_woodpeckers_mutex ); | ||
739 | #endif | ||
740 | } | ||
741 | |||
734 | static void * stats_worker( void * args ) { | 742 | static void * stats_worker( void * args ) { |
735 | int iovec_entries; | 743 | int iovec_entries; |
736 | struct iovec *iovector; | 744 | struct iovec *iovector; |
@@ -39,6 +39,7 @@ enum { | |||
39 | 39 | ||
40 | void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uintptr_t event_data ); | 40 | void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uintptr_t event_data ); |
41 | void stats_deliver( int64 sock, int tasktype ); | 41 | void stats_deliver( int64 sock, int tasktype ); |
42 | void stats_cleanup(); | ||
42 | size_t return_stats_for_tracker( char *reply, int mode, int format ); | 43 | size_t return_stats_for_tracker( char *reply, int mode, int format ); |
43 | size_t stats_return_tracker_version( char *reply ); | 44 | size_t stats_return_tracker_version( char *reply ); |
44 | void stats_init( ); | 45 | void stats_init( ); |