diff options
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/opentracker.c b/opentracker.c index 9e0a18c..b8c90d2 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -472,8 +472,8 @@ static void usage( char *name ) { | |||
472 | static void help( char *name ) { | 472 | static void help( char *name ) { |
473 | usage( name ); | 473 | usage( name ); |
474 | fprintf( stderr, "\t-i serverip\tspecify ip to bind to (default: *, you may specify more than one)\n" | 474 | fprintf( stderr, "\t-i serverip\tspecify ip to bind to (default: *, you may specify more than one)\n" |
475 | "\t-p serverport\tspecify port to bind to (default: 6969, you may specify more than one)\n" | 475 | "\t-p serverport\tspecify tcp port to bind to (default: 6969, you may specify more than one)\n" |
476 | "\t-P serverport\tspecify port to bind to (you may specify more than one)\n" | 476 | "\t-P serverport\tspecify udp port to bind to (default: 6969, you may specify more than one)\n" |
477 | "\t-d serverdir\tspecify directory containing white- or black listed torrent info_hashes (default: \".\")\n" | 477 | "\t-d serverdir\tspecify directory containing white- or black listed torrent info_hashes (default: \".\")\n" |
478 | #ifdef WANT_CLOSED_TRACKER | 478 | #ifdef WANT_CLOSED_TRACKER |
479 | "\t-o\t\tmake tracker an open tracker, e.g. do not check for white list (default: off)\n" | 479 | "\t-o\t\tmake tracker an open tracker, e.g. do not check for white list (default: off)\n" |
@@ -492,7 +492,7 @@ static void help( char *name ) { | |||
492 | #endif | 492 | #endif |
493 | "* To white list a torrent, touch a file inside serverdir with info_hash hex string, preprended by '-'.\n" | 493 | "* To white list a torrent, touch a file inside serverdir with info_hash hex string, preprended by '-'.\n" |
494 | #endif | 494 | #endif |
495 | "\nExample: ./opentracker -i 127.0.0.1 -p 6968 -P 6968 -i 10.1.1.23 -p 6969 -p 6970\n" | 495 | "\nExample: ./opentracker -i 127.0.0.1 -p 6969 -P 6969 -i 10.1.1.23 -p 2710 -p 80\n" |
496 | ); | 496 | ); |
497 | } | 497 | } |
498 | 498 | ||
@@ -556,16 +556,18 @@ static void handle_accept( const int64 serversocket ) { | |||
556 | 556 | ||
557 | io_wantread( i ); | 557 | io_wantread( i ); |
558 | 558 | ||
559 | byte_zero(h,sizeof(struct http_data)); | 559 | byte_zero( h, sizeof( struct http_data ) ); |
560 | memmove(h->ip,ip,sizeof(ip)); | 560 | memmove( h->ip, ip, sizeof( ip ) ); |
561 | io_setcookie(i,h); | 561 | io_setcookie( i, h ); |
562 | |||
562 | ++ot_overall_tcp_connections; | 563 | ++ot_overall_tcp_connections; |
563 | taia_now(&t); | 564 | |
564 | taia_addsec(&t,&t,OT_CLIENT_TIMEOUT); | 565 | taia_now( &t ); |
565 | io_timeout(i,t); | 566 | taia_addsec( &t, &t, OT_CLIENT_TIMEOUT ); |
567 | io_timeout( i, t ); | ||
566 | } | 568 | } |
567 | 569 | ||
568 | if( errno==EAGAIN ) | 570 | if( errno == EAGAIN ) |
569 | io_eagain( serversocket ); | 571 | io_eagain( serversocket ); |
570 | } | 572 | } |
571 | 573 | ||
@@ -747,10 +749,11 @@ int main( int argc, char **argv ) { | |||
747 | } | 749 | } |
748 | } | 750 | } |
749 | 751 | ||
750 | // Bind to our default tcp port | 752 | // Bind to our default tcp/udp ports |
751 | if( !ot_sockets_count ) | 753 | if( !ot_sockets_count ) { |
752 | ot_try_bind( serverip, 6969, 1 ); | 754 | ot_try_bind( serverip, 6969, 1 ); |
753 | 755 | ot_try_bind( serverip, 6969, 0 ); | |
756 | } | ||
754 | setegid( (gid_t)-2 ); setuid( (uid_t)-2 ); | 757 | setegid( (gid_t)-2 ); setuid( (uid_t)-2 ); |
755 | setgid( (gid_t)-2 ); seteuid( (uid_t)-2 ); | 758 | setgid( (gid_t)-2 ); seteuid( (uid_t)-2 ); |
756 | 759 | ||