From 927ac023ce2c761063bbae81bb44b0aab624e36f Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Tue, 6 Nov 2007 18:02:03 +0000 Subject: The expensive DMEM stats is gone. No need for it, too much potential to DOS. --- ot_stats.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'ot_stats.c') diff --git a/ot_stats.c b/ot_stats.c index 97e83dd..587155e 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -162,47 +162,6 @@ bailout_cleanup: return 0; } -size_t return_memstat_for_tracker( char **reply ) { - size_t torrent_count = 0, j; - size_t allocated, replysize; - ot_vector *torrents_list; - int bucket, k; - char *r; - - for( bucket=0; bucketsize; - mutex_bucket_unlock(bucket); - } - - allocated = OT_BUCKET_COUNT*32 + (43+OT_POOLS_COUNT*32)*torrent_count; - if( !( r = *reply = mmap( NULL, allocated, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0 ) ) ) return 0; - - for( bucket=0; bucketsize, (unsigned int)torrents_list->space ); - mutex_bucket_unlock(bucket); - } - - for( bucket=0; bucketsize; ++j ) { - ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list; - ot_hash *hash =&( ((ot_torrent*)(torrents_list->data))[j] ).hash; - r += sprintf( r, "\n%s:\n", to_hex( hex_out, (ot_byte*)hash) ); - for( k=0; kpeers[k].size), (unsigned int)peer_list->peers[k].space ); - } - mutex_bucket_unlock(bucket); - } - - replysize = ( r - *reply ); - fix_mmapallocation( *reply, allocated, replysize ); - - return replysize; -} - static unsigned long events_per_time( unsigned long long events, time_t t ) { return events / ( (unsigned int)t ? (unsigned int)t : 1 ); } -- cgit v1.2.3