diff --git a/Makefile b/Makefile index f13baa2..7f43829 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ FEATURES+=-DWANT_FULLSCRAPE #FEATURES+=-DWANT_ARC4RANDOM #FEATURES+=-D_DEBUG_HTTPERROR +#FEATURES+=-D_DEBUG_RANDOMTORRENTS OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage OPTS_production=-O3 diff --git a/opentracker.c b/opentracker.c index e025bfa..596c2a7 100644 --- a/opentracker.c +++ b/opentracker.c @@ -726,6 +726,10 @@ int main( int argc, char **argv ) { /* Init all sub systems. This call may fail with an exit() */ trackerlogic_init( ); +#ifdef _DEBUG_RANDOMTORRENTS + trackerlogic_add_random_torrents(1024*1024*1); +#endif + if( statefile ) load_state( statefile ); diff --git a/trackerlogic.c b/trackerlogic.c index 13d2741..e2ac5b3 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -517,6 +517,7 @@ size_t peer_size_from_peer6(ot_peer6 *peer) { return OT_PEER_SIZE4; } +#ifdef _DEBUG_RANDOMTORRENTS void trackerlogic_add_random_torrents(size_t amount) { struct ot_workstruct ws; memset( &ws, 0, sizeof(ws) ); @@ -538,7 +539,7 @@ void trackerlogic_add_random_torrents(size_t amount) { free(ws.inbuf); free(ws.outbuf); } - +#endif void exerr( char * message ) { fprintf( stderr, "%s\n", message ); diff --git a/trackerlogic.h b/trackerlogic.h index bc488c9..7e6e8ad 100644 --- a/trackerlogic.h +++ b/trackerlogic.h @@ -190,7 +190,9 @@ size_t remove_peer_from_torrent( PROTO_FLAG proto, struct ot_workstruct *ws ); size_t return_tcp_scrape_for_torrent( ot_hash const *hash_list, int amount, char *reply ); size_t return_udp_scrape_for_torrent( ot_hash const hash, char *reply ); void add_torrent_from_saved_state( ot_hash const hash, ot_time base, size_t down_count ); +#ifdef _DEBUG_RANDOMTORRENTS void trackerlogic_add_random_torrents(size_t amount); +#endif /* torrent iterator */ void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data );