MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterBroadcastMessage

Function clusterBroadcastMessage

app/redis-6.2.6/src/cluster.c:2416–2430  ·  view source on GitHub ↗

Send a message to all the nodes that are part of the cluster having * a connected link. * * It is guaranteed that this function will never have as a side effect * some node->link to be invalidated, so it is safe to call this function * from event handlers that will do stuff with node links later. */

Source from the content-addressed store, hash-verified

2414 * some node->link to be invalidated, so it is safe to call this function
2415 * from event handlers that will do stuff with node links later. */
2416void clusterBroadcastMessage(void *buf, size_t len) {
2417 dictIterator *di;
2418 dictEntry *de;
2419
2420 di = dictGetSafeIterator(server.cluster->nodes);
2421 while((de = dictNext(di)) != NULL) {
2422 clusterNode *node = dictGetVal(de);
2423
2424 if (!node->link) continue;
2425 if (node->flags & (CLUSTER_NODE_MYSELF|CLUSTER_NODE_HANDSHAKE))
2426 continue;
2427 clusterSendMessage(node->link,buf,len);
2428 }
2429 dictReleaseIterator(di);
2430}
2431
2432/* Build the message header. hdr must point to a buffer at least
2433 * sizeof(clusterMsg) in bytes. */

Callers 4

clusterSendPublishFunction · 0.85
clusterSendFailFunction · 0.85
clusterSendModuleFunction · 0.85

Calls 4

dictGetSafeIteratorFunction · 0.85
clusterSendMessageFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected