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. */
| 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. */ |
| 2416 | void 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. */ |
no test coverage detected