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. */
| 2816 | * The function returns C_OK if the target is valid, otherwise C_ERR is |
| 2817 | * returned. */ |
| 2818 | int clusterSendModuleMessageToTarget(const char *target, uint64_t module_id, uint8_t type, unsigned char *payload, uint32_t len) { |
| 2819 | clusterNode *node = NULL; |
| 2820 | |
| 2821 | if (target != NULL) { |
| 2822 | node = clusterLookupNode(target); |
| 2823 | if (node == NULL || node->link == NULL) return C_ERR; |
| 2824 | } |
| 2825 | |
| 2826 | clusterSendModule(target ? node->link : NULL, |
| 2827 | module_id, type, payload, len); |
| 2828 | return C_OK; |
| 2829 | } |
| 2830 | |
| 2831 | /* ----------------------------------------------------------------------------- |
| 2832 | * CLUSTER Pub/Sub support |
no test coverage detected