summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--opentracker.c4
-rw-r--r--trackerlogic.c3
-rw-r--r--trackerlogic.h2
4 files changed, 9 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index f13baa2..7f43829 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ FEATURES+=-DWANT_FULLSCRAPE
43#FEATURES+=-DWANT_ARC4RANDOM 43#FEATURES+=-DWANT_ARC4RANDOM
44 44
45#FEATURES+=-D_DEBUG_HTTPERROR 45#FEATURES+=-D_DEBUG_HTTPERROR
46#FEATURES+=-D_DEBUG_RANDOMTORRENTS
46 47
47OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage 48OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage
48OPTS_production=-O3 49OPTS_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 ) {
726 /* Init all sub systems. This call may fail with an exit() */ 726 /* Init all sub systems. This call may fail with an exit() */
727 trackerlogic_init( ); 727 trackerlogic_init( );
728 728
729#ifdef _DEBUG_RANDOMTORRENTS
730 trackerlogic_add_random_torrents(1024*1024*1);
731#endif
732
729 if( statefile ) 733 if( statefile )
730 load_state( statefile ); 734 load_state( statefile );
731 735
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) {
517 return OT_PEER_SIZE4; 517 return OT_PEER_SIZE4;
518} 518}
519 519
520#ifdef _DEBUG_RANDOMTORRENTS
520void trackerlogic_add_random_torrents(size_t amount) { 521void trackerlogic_add_random_torrents(size_t amount) {
521 struct ot_workstruct ws; 522 struct ot_workstruct ws;
522 memset( &ws, 0, sizeof(ws) ); 523 memset( &ws, 0, sizeof(ws) );
@@ -538,7 +539,7 @@ void trackerlogic_add_random_torrents(size_t amount) {
538 free(ws.inbuf); 539 free(ws.inbuf);
539 free(ws.outbuf); 540 free(ws.outbuf);
540} 541}
541 542#endif
542 543
543void exerr( char * message ) { 544void exerr( char * message ) {
544 fprintf( stderr, "%s\n", message ); 545 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 );
190size_t return_tcp_scrape_for_torrent( ot_hash const *hash_list, int amount, char *reply ); 190size_t return_tcp_scrape_for_torrent( ot_hash const *hash_list, int amount, char *reply );
191size_t return_udp_scrape_for_torrent( ot_hash const hash, char *reply ); 191size_t return_udp_scrape_for_torrent( ot_hash const hash, char *reply );
192void add_torrent_from_saved_state( ot_hash const hash, ot_time base, size_t down_count ); 192void add_torrent_from_saved_state( ot_hash const hash, ot_time base, size_t down_count );
193#ifdef _DEBUG_RANDOMTORRENTS
193void trackerlogic_add_random_torrents(size_t amount); 194void trackerlogic_add_random_torrents(size_t amount);
195#endif
194 196
195/* torrent iterator */ 197/* torrent iterator */
196void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data ); 198void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data );