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. */
| 2472 | * some node->link to be invalidated, so it is safe to call this function |
| 2473 | * from event handlers that will do stuff with node links later. */ |
| 2474 | void clusterBroadcastMessage(void *buf, size_t len) { |
| 2475 | dictIterator *di; |
| 2476 | dictEntry *de; |
| 2477 | |
| 2478 | di = dictGetSafeIterator(g_pserver->cluster->nodes); |
| 2479 | while((de = dictNext(di)) != NULL) { |
| 2480 | clusterNode *node = (clusterNode*)dictGetVal(de); |
| 2481 | |
| 2482 | if (!node->link) continue; |
| 2483 | if (node->flags & (CLUSTER_NODE_MYSELF|CLUSTER_NODE_HANDSHAKE)) |
| 2484 | continue; |
| 2485 | clusterSendMessage(node->link,(unsigned char*)buf,len); |
| 2486 | } |
| 2487 | dictReleaseIterator(di); |
| 2488 | } |
| 2489 | |
| 2490 | /* Build the message header. hdr must point to a buffer at least |
| 2491 | * sizeof(clusterMsg) in bytes. */ |
no test coverage detected