diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | opentracker.c | 4 | ||||
-rw-r--r-- | trackerlogic.c | 3 | ||||
-rw-r--r-- | trackerlogic.h | 2 |
4 files changed, 9 insertions, 1 deletions
@@ -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 | ||
47 | OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage | 48 | OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage |
48 | OPTS_production=-O3 | 49 | 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 ) { | |||
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 | ||
520 | void trackerlogic_add_random_torrents(size_t amount) { | 521 | void 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 | ||
543 | void exerr( char * message ) { | 544 | void 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 ); | |||
190 | size_t return_tcp_scrape_for_torrent( ot_hash const *hash_list, int amount, char *reply ); | 190 | size_t return_tcp_scrape_for_torrent( ot_hash const *hash_list, int amount, char *reply ); |
191 | size_t return_udp_scrape_for_torrent( ot_hash const hash, char *reply ); | 191 | size_t return_udp_scrape_for_torrent( ot_hash const hash, char *reply ); |
192 | void add_torrent_from_saved_state( ot_hash const hash, ot_time base, size_t down_count ); | 192 | void add_torrent_from_saved_state( ot_hash const hash, ot_time base, size_t down_count ); |
193 | #ifdef _DEBUG_RANDOMTORRENTS | ||
193 | void trackerlogic_add_random_torrents(size_t amount); | 194 | void trackerlogic_add_random_torrents(size_t amount); |
195 | #endif | ||
194 | 196 | ||
195 | /* torrent iterator */ | 197 | /* torrent iterator */ |
196 | void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data ); | 198 | void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data ); |