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

Function clusterBroadcastPong

src/cluster.cpp:2738–2757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2736#define CLUSTER_BROADCAST_ALL 0
2737#define CLUSTER_BROADCAST_LOCAL_SLAVES 1
2738void clusterBroadcastPong(int target) {
2739 dictIterator *di;
2740 dictEntry *de;
2741
2742 di = dictGetSafeIterator(g_pserver->cluster->nodes);
2743 while((de = dictNext(di)) != NULL) {
2744 clusterNode *node = (clusterNode*)dictGetVal(de);
2745
2746 if (!node->link) continue;
2747 if (node == myself || nodeInHandshake(node)) continue;
2748 if (target == CLUSTER_BROADCAST_LOCAL_SLAVES) {
2749 int local_slave =
2750 nodeIsSlave(node) && node->slaveof &&
2751 (node->slaveof == myself || node->slaveof == myself->slaveof);
2752 if (!local_slave) continue;
2753 }
2754 clusterSendPing(node->link,CLUSTERMSG_TYPE_PONG);
2755 }
2756 dictReleaseIterator(di);
2757}
2758
2759/* Send a PUBLISH message.
2760 *

Callers 3

clusterCommandFunction · 0.85

Calls 4

dictGetSafeIteratorFunction · 0.85
clusterSendPingFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected