tabled: use "auto" keyword
PATCH 3/3 tabled: use "auto" keyword
The current implementation of automatic listening ports was configured implicitly by adding <PortFile> clause. This turned out to be a silly idea. A special keyword for <Port> is more convenient.
This should be built after both CLD and Chunk implement "auto" keyword.
Signed-off-by Pete Zaitcev <[email protected]>
server/config.c +4 -8
@@ -75,13 +75,8 @@ static void cfg_elm_end_listen(struct config_context *cc)return ; } -if (cc->tmp_listen.port && cc->tmp_listen.port_file) { -applog (LOG_ERR ,"cfgfile: Listen with both Port and PortFile" ); - goto err; - } - -if (!cc->tmp_listen.port && !cc->tmp_listen.port_file) { -applog (LOG_ERR ,"cfgfile: Listen with no Port or PortFile" ); +if (!cc->tmp_listen.port) { +applog (LOG_ERR ,"cfgfile: Listen with no Port" ); goto err; }
@@ -270,7 +265,8 @@ static void cfg_elm_end (GMarkupParseContext *context,if (cc->in_listen) { n =strtol (cc->text,NULL ,10 ); -if (n >0 && n <65536 ) { +if ((n >0 && n <65536 ) || + !strcmp (cc->text,"auto" )) {free (cc->tmp_listen.port); cc->tmp_listen.port = cc->text; }else {
server/server.c +37 -17
86 lines not on this page · raw message
test/chunkd-test.conf +1 -1
@@ -1,6 +1,6 @@ <Listen> - <PortFile>/dev/null</PortFile> + <Port>auto</Port> </Listen> <PID>chunkd.pid</PID> <Path>data/chunk</Path>
test/start-daemon +1 -1
@@ -17,7 +17,7 @@ then fi # May be different on Solaris... like /usr/libexec or such. -cld -d data/cld -P cld.pid --port-file=cld.port -E +cld -d data/cld -P cld.pid -p auto --port-file=cld.port -E chunkd -C $top_srcdir/test/chunkd-test.conf -E ../server/tabled -C $top_srcdir/test/tabled-test.conf -E -D
test/tabled-test.conf +4 -1
@@ -1,7 +1,10 @@ <PID>tabled.pid</PID> <ForceHost>localhost.localdomain</ForceHost> -<Listen><PortFile>tabled.acc</PortFile></Listen> +<Listen> + <Port>auto</Port> + <PortFile>tabled.acc</PortFile> +</Listen> <TDB>data/tdb</TDB> <TDBRepPort>18083</TDBRepPort>
Jeff Garzik
AppliedQuoted 7 lines · Pete Zaitcev
The current implementation of automatic listening ports was configured implicitly by adding<PortFile> clause. This turned out to be a silly idea. A special keyword for<Port> is more convenient.
This should be built after both CLD and Chunk implement "auto" keyword.
Signed-off-by Pete Zaitcev<[email protected]>
applied