diff options
Diffstat (limited to 'trackerlogic.c')
-rw-r--r-- | trackerlogic.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/trackerlogic.c b/trackerlogic.c index 6fd2724..13d2741 100644 --- a/trackerlogic.c +++ b/trackerlogic.c | |||
@@ -517,6 +517,29 @@ size_t peer_size_from_peer6(ot_peer6 *peer) { | |||
517 | return OT_PEER_SIZE4; | 517 | return OT_PEER_SIZE4; |
518 | } | 518 | } |
519 | 519 | ||
520 | void trackerlogic_add_random_torrents(size_t amount) { | ||
521 | struct ot_workstruct ws; | ||
522 | memset( &ws, 0, sizeof(ws) ); | ||
523 | |||
524 | ws.inbuf=malloc(G_INBUF_SIZE); | ||
525 | ws.outbuf=malloc(G_OUTBUF_SIZE); | ||
526 | ws.reply=ws.outbuf; | ||
527 | ws.hash=ws.inbuf; | ||
528 | |||
529 | while( amount-- ) { | ||
530 | arc4random_buf(ws.hash, sizeof(ot_hash)); | ||
531 | arc4random_buf(&ws.peer, sizeof(ws.peer)); | ||
532 | |||
533 | OT_PEERFLAG(ws.peer) &= PEER_FLAG_SEEDING | PEER_FLAG_COMPLETED | PEER_FLAG_STOPPED; | ||
534 | |||
535 | add_peer_to_torrent_and_return_peers( FLAG_TCP, &ws, 1 ); | ||
536 | } | ||
537 | |||
538 | free(ws.inbuf); | ||
539 | free(ws.outbuf); | ||
540 | } | ||
541 | |||
542 | |||
520 | void exerr( char * message ) { | 543 | void exerr( char * message ) { |
521 | fprintf( stderr, "%s\n", message ); | 544 | fprintf( stderr, "%s\n", message ); |
522 | exit( 111 ); | 545 | exit( 111 ); |