summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2012-06-03 04:06:32 +0000
committererdgeist <>2012-06-03 04:06:32 +0000
commit5233046241ee7270ddb481d63fbed14a55cb66ab (patch)
treeec059297c768e707de9fc07e12fbdaa6a984c44b
parent8741c91a7d6f9833301383aa819872e16ed43e25 (diff)
Make woodpecker spotting more usable by adjusting count every 2 minutes
-rw-r--r--ot_clean.c2
-rw-r--r--ot_stats.c8
-rw-r--r--ot_stats.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/ot_clean.c b/ot_clean.c
index 6024c08..4c03416 100644
--- a/ot_clean.c
+++ b/ot_clean.c
@@ -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 */
21static ssize_t clean_single_bucket( ot_peer *peers, size_t peer_count, time_t timedout, int *removed_seeders ) { 22static 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}
diff --git a/ot_stats.c b/ot_stats.c
index 018098d..4edfad7 100644
--- a/ot_stats.c
+++ b/ot_stats.c
@@ -731,6 +731,14 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uintptr_t event
731 } 731 }
732} 732}
733 733
734void 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
734static void * stats_worker( void * args ) { 742static void * stats_worker( void * args ) {
735 int iovec_entries; 743 int iovec_entries;
736 struct iovec *iovector; 744 struct iovec *iovector;
diff --git a/ot_stats.h b/ot_stats.h
index 821bc2b..4c59f8b 100644
--- a/ot_stats.h
+++ b/ot_stats.h
@@ -39,6 +39,7 @@ enum {
39 39
40void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uintptr_t event_data ); 40void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uintptr_t event_data );
41void stats_deliver( int64 sock, int tasktype ); 41void stats_deliver( int64 sock, int tasktype );
42void stats_cleanup();
42size_t return_stats_for_tracker( char *reply, int mode, int format ); 43size_t return_stats_for_tracker( char *reply, int mode, int format );
43size_t stats_return_tracker_version( char *reply ); 44size_t stats_return_tracker_version( char *reply );
44void stats_init( ); 45void stats_init( );