Call EXEC command on a cluster node. */
| 2786 | |
| 2787 | /* Call EXEC command on a cluster node. */ |
| 2788 | static int clusterManagerExecTransaction(clusterManagerNode *node, |
| 2789 | clusterManagerOnReplyError onerror) |
| 2790 | { |
| 2791 | redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "EXEC"); |
| 2792 | int success = clusterManagerCheckRedisReply(node, reply, NULL); |
| 2793 | if (success) { |
| 2794 | if (reply->type != REDIS_REPLY_ARRAY) { |
| 2795 | success = 0; |
| 2796 | goto cleanup; |
| 2797 | } |
| 2798 | size_t i; |
| 2799 | for (i = 0; i < reply->elements; i++) { |
| 2800 | redisReply *r = reply->element[i]; |
| 2801 | char *err = NULL; |
| 2802 | success = clusterManagerCheckRedisReply(node, r, &err); |
| 2803 | if (!success && onerror) success = onerror(r, node, i); |
| 2804 | if (err) { |
| 2805 | if (!success) |
| 2806 | CLUSTER_MANAGER_PRINT_REPLY_ERROR(node, err); |
| 2807 | zfree(err); |
| 2808 | } |
| 2809 | if (!success) break; |
| 2810 | } |
| 2811 | } |
| 2812 | cleanup: |
| 2813 | if (reply) freeReplyObject(reply); |
| 2814 | return success; |
| 2815 | } |
| 2816 | |
| 2817 | static int clusterManagerNodeConnect(clusterManagerNode *node) { |
| 2818 | if (node->context) redisFree(node->context); |
no test coverage detected