From 9297967f8523f1ac22bbac1823529b970a07cf56 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Wed, 4 Mar 2009 14:35:21 +0000 Subject: Add a stat option the count bucket stalls Add an iterator for all torrents. It's slower but for stats it's okay. Move some stats collection stuff to the new iterator. More to come. Start a "report all stats" page. Start fixing the code to identify "busy" networks. Add the concept of hosts allowed to proxy. Add a parser for the X-Forwarded-For: HTTP header. Clean up HTTP Header handling code. (Remove some left overs of now vanished sync code). --- trackerlogic.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'trackerlogic.c') diff --git a/trackerlogic.c b/trackerlogic.c index 249a2a0..8ebaa46 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -337,6 +337,23 @@ size_t remove_peer_from_torrent( ot_hash hash, ot_peer *peer, char *reply, PROTO return reply_size; } +void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data ) { + int bucket; + size_t j; + + for( bucket=0; bucketdata); + + for( j=0; jsize; ++j ) + if( for_each( torrents + j, data ) ) + break; + + mutex_bucket_unlock( bucket, 0 ); + if( !g_opentracker_running ) return; + } +} + void exerr( char * message ) { fprintf( stderr, "%s\n", message ); exit( 111 ); @@ -358,7 +375,7 @@ void trackerlogic_init( ) { void trackerlogic_deinit( void ) { int bucket, delta_torrentcount = 0; size_t j; - + /* Free all torrents... */ for(bucket=0; bucket