summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
authorerdgeist <>2012-04-25 05:48:16 +0000
committererdgeist <>2012-04-25 05:48:16 +0000
commit914e0ac3020b7c842f2a1fd975217f70fa705449 (patch)
treefeb12cf179fe21873966f2c7f51b890e3aa4a3f5 /opentracker.c
parentae413a675b1d7e040997cb8f655672d144832a6f (diff)
Add functionality to distribute udp to several workers
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c11
1 files changed, 10 insertions, 1 deletions
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];
46 46
47static char * g_serverdir; 47static char * g_serverdir;
48static char * g_serveruser; 48static char * g_serveruser;
49static unsigned int g_udp_workers;
49 50
50static void panic( const char *routine ) { 51static void panic( const char *routine ) {
51 fprintf( stderr, "%s: %s\n", routine, strerror(errno) ); 52 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 ) {
328 329
329 io_setcookie( sock, (void*)proto ); 330 io_setcookie( sock, (void*)proto );
330 331
331 io_wantread( sock ); 332 if( (proto == FLAG_UDP) && g_udp_workers ) {
333 io_block( sock );
334 udp_init( sock, g_udp_workers );
335 } else
336 io_wantread( sock );
332 337
333#ifdef _DEBUG 338#ifdef _DEBUG
334 fputs( " success.\n", stderr); 339 fputs( " success.\n", stderr);
@@ -416,6 +421,10 @@ int parse_configfile( char * config_filename ) {
416 if( !scan_ip6_port( p+11, tmpip, &tmpport )) goto parse_error; 421 if( !scan_ip6_port( p+11, tmpip, &tmpport )) goto parse_error;
417 ot_try_bind( tmpip, tmpport, FLAG_UDP ); 422 ot_try_bind( tmpip, tmpport, FLAG_UDP );
418 ++bound; 423 ++bound;
424 } else if(!byte_diff(p,18,"listen.udp.workers" ) && isspace(p[18])) {
425 char *value = p + 18;
426 while( isspace(*value) ) ++value;
427 scan_uint( value, &g_udp_workers );
419#ifdef WANT_ACCESSLIST_WHITE 428#ifdef WANT_ACCESSLIST_WHITE
420 } else if(!byte_diff(p, 16, "access.whitelist" ) && isspace(p[16])) { 429 } else if(!byte_diff(p, 16, "access.whitelist" ) && isspace(p[16])) {
421 set_config_option( &g_accesslist_filename, p+17 ); 430 set_config_option( &g_accesslist_filename, p+17 );