From 914e0ac3020b7c842f2a1fd975217f70fa705449 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Wed, 25 Apr 2012 05:48:16 +0000 Subject: Add functionality to distribute udp to several workers --- opentracker.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'opentracker.c') diff --git a/opentracker.c b/opentracker.c index 0c535ec..c735393 100644 --- a/opentracker.c +++ b/opentracker.c @@ -46,6 +46,7 @@ int g_self_pipe[2]; static char * g_serverdir; static char * g_serveruser; +static unsigned int g_udp_workers; static void panic( const char *routine ) { fprintf( stderr, "%s: %s\n", routine, strerror(errno) ); @@ -328,7 +329,11 @@ static int64_t ot_try_bind( ot_ip6 ip, uint16_t port, PROTO_FLAG proto ) { io_setcookie( sock, (void*)proto ); - io_wantread( sock ); + if( (proto == FLAG_UDP) && g_udp_workers ) { + io_block( sock ); + udp_init( sock, g_udp_workers ); + } else + io_wantread( sock ); #ifdef _DEBUG fputs( " success.\n", stderr); @@ -416,6 +421,10 @@ int parse_configfile( char * config_filename ) { if( !scan_ip6_port( p+11, tmpip, &tmpport )) goto parse_error; ot_try_bind( tmpip, tmpport, FLAG_UDP ); ++bound; + } else if(!byte_diff(p,18,"listen.udp.workers" ) && isspace(p[18])) { + char *value = p + 18; + while( isspace(*value) ) ++value; + scan_uint( value, &g_udp_workers ); #ifdef WANT_ACCESSLIST_WHITE } else if(!byte_diff(p, 16, "access.whitelist" ) && isspace(p[16])) { set_config_option( &g_accesslist_filename, p+17 ); -- cgit v1.2.3