diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cluster.c | 8 | ||||
-rw-r--r-- | src/cluster.h | 1 | ||||
-rw-r--r-- | src/config.c | 12 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/cluster.c b/src/cluster.c index 45e7bf92a..499daf687 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -753,6 +753,14 @@ void clusterUpdateMyselfFlags(void) { } +/* We want to take myself->port/cport/pport in sync with the +* cluster-announce-port/cluster-announce-bus-port/cluster-announce-tls-port option. +* The option can be set at runtime via CONFIG SET. */ +void clusterUpdateMyselfAnnouncedPorts(void) { + if (!myself) return; + deriveAnnouncedPorts(&myself->port,&myself->pport,&myself->cport); +} + /* We want to take myself->ip in sync with the cluster-announce-ip option. * The option can be set at runtime via CONFIG SET. */ void clusterUpdateMyselfIp(void) { diff --git a/src/cluster.h b/src/cluster.h index 332624ea5..4f1f9bf87 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -418,5 +418,6 @@ void clusterUpdateMyselfIp(void); void slotToChannelAdd(sds channel); void slotToChannelDel(sds channel); void clusterUpdateMyselfHostname(void); +void clusterUpdateMyselfAnnouncedPorts(void); #endif /* __CLUSTER_H */ diff --git a/src/config.c b/src/config.c index c5eab41a9..e57946429 100644 --- a/src/config.c +++ b/src/config.c @@ -2591,6 +2591,12 @@ int updateClusterFlags(const char **err) { return 1; } +static int updateClusterAnnouncedPort(const char **err) { + UNUSED(err); + clusterUpdateMyselfAnnouncedPorts(); + return 1; +} + static int updateClusterIp(const char **err) { UNUSED(err); clusterUpdateMyselfIp(); @@ -3087,9 +3093,9 @@ standardConfig static_configs[] = { createIntConfig("replica-announce-port", "slave-announce-port", MODIFIABLE_CONFIG, 0, 65535, server.slave_announce_port, 0, INTEGER_CONFIG, NULL, NULL), createIntConfig("tcp-backlog", NULL, IMMUTABLE_CONFIG, 0, INT_MAX, server.tcp_backlog, 511, INTEGER_CONFIG, NULL, NULL), /* TCP listen backlog. */ createIntConfig("cluster-port", NULL, IMMUTABLE_CONFIG, 0, 65535, server.cluster_port, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("cluster-announce-bus-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_bus_port, 0, INTEGER_CONFIG, NULL, NULL), /* Default: Use +10000 offset. */ - createIntConfig("cluster-announce-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_port, 0, INTEGER_CONFIG, NULL, NULL), /* Use server.port */ - createIntConfig("cluster-announce-tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_tls_port, 0, INTEGER_CONFIG, NULL, NULL), /* Use server.tls_port */ + createIntConfig("cluster-announce-bus-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_bus_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), /* Default: Use +10000 offset. */ + createIntConfig("cluster-announce-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), /* Use server.port */ + createIntConfig("cluster-announce-tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_tls_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), /* Use server.tls_port */ createIntConfig("repl-timeout", NULL, MODIFIABLE_CONFIG, 1, INT_MAX, server.repl_timeout, 60, INTEGER_CONFIG, NULL, NULL), createIntConfig("repl-ping-replica-period", "repl-ping-slave-period", MODIFIABLE_CONFIG, 1, INT_MAX, server.repl_ping_slave_period, 10, INTEGER_CONFIG, NULL, NULL), createIntConfig("list-compress-depth", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, 0, INT_MAX, server.list_compress_depth, 0, INTEGER_CONFIG, NULL, NULL), |