diff --git a/opentracker.c b/opentracker.c index aed8374..eacdf16 100644 --- a/opentracker.c +++ b/opentracker.c @@ -43,6 +43,7 @@ char * g_redirecturl; uint32_t g_tracker_id; volatile int g_opentracker_running = 1; int g_self_pipe[2]; +int g_queuedepth = SOMAXCONN; static char * g_serverdir; static char * g_serveruser; @@ -323,7 +324,7 @@ static int64_t ot_try_bind( ot_ip6 ip, uint16_t port, PROTO_FLAG proto ) { if( socket_bind6_reuse( sock, ip, port, 0 ) == -1 ) panic( "socket_bind6_reuse" ); - if( ( proto == FLAG_TCP ) && ( socket_listen( sock, SOMAXCONN) == -1 ) ) + if( ( proto == FLAG_TCP ) && ( socket_listen( sock, g_queuedepth) == -1 ) ) panic( "socket_listen" ); if( !io_fd( sock ) ) @@ -408,6 +409,10 @@ int parse_configfile( char * config_filename ) { set_config_option( &g_serverdir, p+16 ); } else if(!byte_diff(p,12,"tracker.user" ) && isspace(p[12])) { set_config_option( &g_serveruser, p+13 ); + } else if(!byte_diff(p,21,"listen.tcp.queuedepth" ) && isspace(p[21])) { + char *val = p + 21; + while( isspace(*val) ) ++val; + scan_int( val, &g_queuedepth ); } else if(!byte_diff(p,14,"listen.tcp_udp" ) && isspace(p[14])) { uint16_t tmpport = 6969; if( !scan_ip6_port( p+15, tmpip, &tmpport )) goto parse_error;