This function gets a cluster node ID string as target, the same way the nodes * addresses are represented in the modules side, resolves the node, and sends * the message. If the target is NULL the message is broadcasted. * * The function returns C_OK if the target is valid, otherwise C_ERR is * returned. */
| 2874 | * The function returns C_OK if the target is valid, otherwise C_ERR is |
| 2875 | * returned. */ |
| 2876 | int clusterSendModuleMessageToTarget(const char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len) { |
| 2877 | clusterNode *node = NULL; |
| 2878 | |
| 2879 | if (target != NULL) { |
| 2880 | node = clusterLookupNode(target); |
| 2881 | if (node == NULL || node->link == NULL) return C_ERR; |
| 2882 | } |
| 2883 | |
| 2884 | clusterSendModule(target ? node->link : NULL, |
| 2885 | module_id, type, payload, len); |
| 2886 | return C_OK; |
| 2887 | } |
| 2888 | |
| 2889 | /* ----------------------------------------------------------------------------- |
| 2890 | * CLUSTER Pub/Sub support |
no test coverage detected