MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / deriveAnnouncedPorts

Function deriveAnnouncedPorts

src/cluster.cpp:459–476  ·  view source on GitHub ↗

Derives our ports to be announced in the cluster bus. */

Source from the content-addressed store, hash-verified

457
458/* Derives our ports to be announced in the cluster bus. */
459void deriveAnnouncedPorts(int *announced_port, int *announced_pport,
460 int *announced_cport) {
461 int port = g_pserver->tls_cluster ? g_pserver->tls_port : g_pserver->port;
462 /* Default announced ports. */
463 *announced_port = port;
464 *announced_pport = g_pserver->tls_cluster ? g_pserver->port : 0;
465 *announced_cport = port + CLUSTER_PORT_INCR;
466 /* Config overriding announced ports. */
467 if (g_pserver->tls_cluster && g_pserver->cluster_announce_tls_port) {
468 *announced_port = g_pserver->cluster_announce_tls_port;
469 *announced_pport = g_pserver->cluster_announce_port;
470 } else if (g_pserver->cluster_announce_port) {
471 *announced_port = g_pserver->cluster_announce_port;
472 }
473 if (g_pserver->cluster_announce_bus_port) {
474 *announced_cport = g_pserver->cluster_announce_bus_port;
475 }
476}
477
478/* Some flags (currently just the NOFAILOVER flag) may need to be updated
479 * in the "myself" node based on the current configuration of the node,

Callers 2

clusterInitFunction · 0.85
clusterBuildMessageHdrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected