summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--opentracker.c29
2 files changed, 17 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 5eb7ac9..1bfbe59 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ CC?=gcc
2FEATURES=#-DWANT_IP_FROM_QUERY_STRING -DWANT_BLACKLIST -DWANT_CLOSED_TRACKER -D_DEBUG_HTTPERROR 2FEATURES=#-DWANT_IP_FROM_QUERY_STRING -DWANT_BLACKLIST -DWANT_CLOSED_TRACKER -D_DEBUG_HTTPERROR
3#DEBUG_OPTS=-g -ggdb -pg # -fprofile-arcs -ftest-coverage 3#DEBUG_OPTS=-g -ggdb -pg # -fprofile-arcs -ftest-coverage
4DEBUG_OPTS=-s -Os 4DEBUG_OPTS=-s -Os
5CFLAGS+=-I../libowfat -Wall -pipe # -pedantic -ansi 5CFLAGS+=-I../libowfat -Wall -pipe -m64# -pedantic -ansi
6LDFLAGS+=-L../libowfat/ -lowfat 6LDFLAGS+=-L../libowfat/ -lowfat
7 7
8HEADERS=trackerlogic.h scan_urlencoded_query.h 8HEADERS=trackerlogic.h scan_urlencoded_query.h
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 ) {
472static void help( char *name ) { 472static 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