mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Cluster: persist bus port in nodes.conf.
This commit is contained in:
parent
dc98907e50
commit
1c038379f7
@ -168,7 +168,12 @@ int clusterLoadConfig(char *filename) {
|
|||||||
if ((p = strrchr(argv[1],':')) == NULL) goto fmterr;
|
if ((p = strrchr(argv[1],':')) == NULL) goto fmterr;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
memcpy(n->ip,argv[1],strlen(argv[1])+1);
|
memcpy(n->ip,argv[1],strlen(argv[1])+1);
|
||||||
|
char *busp = strchr(p+1,':');
|
||||||
|
if (busp) *busp = '\0';
|
||||||
n->port = atoi(p+1);
|
n->port = atoi(p+1);
|
||||||
|
/* In older versions of nodes.conf the bus port is missing. In this case
|
||||||
|
* we set it to the default offset of 10000 from the base port. */
|
||||||
|
n->cport = busp ? atoi(busp+1) : n->port + CLUSTER_PORT_INCR;
|
||||||
|
|
||||||
/* Parse flags */
|
/* Parse flags */
|
||||||
p = s = argv[2];
|
p = s = argv[2];
|
||||||
@ -3731,10 +3736,11 @@ sds clusterGenNodeDescription(clusterNode *node) {
|
|||||||
sds ci;
|
sds ci;
|
||||||
|
|
||||||
/* Node coordinates */
|
/* Node coordinates */
|
||||||
ci = sdscatprintf(sdsempty(),"%.40s %s:%d ",
|
ci = sdscatprintf(sdsempty(),"%.40s %s:%d:%d ",
|
||||||
node->name,
|
node->name,
|
||||||
node->ip,
|
node->ip,
|
||||||
node->port);
|
node->port,
|
||||||
|
node->cport);
|
||||||
|
|
||||||
/* Flags */
|
/* Flags */
|
||||||
ci = representClusterNodeFlags(ci, node->flags);
|
ci = representClusterNodeFlags(ci, node->flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user