Skip to contentSkip to conversation

CLD: use "auto" keyword

PATCH Applied Pete Zaitcev 2 participants 2 messages Sep 29, 2009 – Sep 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 CLD: 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. See how much nicer the test/start-daemon script looks now.

The configuration is not strictly speaking compatible, but since nobody should be using auto ports in production anyway, impact on installations should be nil. Builds are interdependent though.

server/cld.h +1 -2
index e5ea9aa..7a353b1 100644
@@ -112,9 +112,8 @@ struct server {
 	char			*pid_file;	/* PID file */
 	int			pid_fd;
 
-	char			*port;		/* bind port */
+	char			*port;		/* bind port, NULL means auto */
 	char			*port_file;	/* Port file to write */
-	bool			port_set;
 
 	struct cldb		cldb;		/* database info */
 
server/server.c +36 -21

121 lines not on this page · raw message

test/start-daemon +2 -4
index fc27775..15d4546 100755
@@ -7,11 +7,9 @@ then
 fi
 
 ## Static port
-# cldport=18181
-# echo $cldport > cld.port
-# ../server/cld -P cld.pid -d "$PWD/data" -p $cldport -E
+# ../server/cld -P cld.pid -d "$PWD/data" -p 18181 --port-file=cld.port -E
 ## Dynamic port
-../server/cld -P cld.pid -d "$PWD/data" --port-file=cld.port -E
+../server/cld -P cld.pid -d "$PWD/data" -p auto --port-file=cld.port -E
 
 sleep 3
 
Applied
#1 lore raw
Quoted 10 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. See how much nicer the test/start-daemon script looks now.

The configuration is not strictly speaking compatible, but since nobody should be using auto ports in production anyway, impact on installations should be nil. Builds are interdependent though.

applied