Call EXEC command on a cluster node. */
| 2494 | |
| 2495 | /* Call EXEC command on a cluster node. */ |
| 2496 | static int clusterManagerExecTransaction(clusterManagerNode *node, |
| 2497 | clusterManagerOnReplyError onerror) |
| 2498 | { |
| 2499 | redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "EXEC"); |
| 2500 | int success = clusterManagerCheckRedisReply(node, reply, NULL); |
| 2501 | if (success) { |
| 2502 | if (reply->type != REDIS_REPLY_ARRAY) { |
| 2503 | success = 0; |
| 2504 | goto cleanup; |
| 2505 | } |
| 2506 | size_t i; |
| 2507 | for (i = 0; i < reply->elements; i++) { |
| 2508 | redisReply *r = reply->element[i]; |
| 2509 | char *err = NULL; |
| 2510 | success = clusterManagerCheckRedisReply(node, r, &err); |
| 2511 | if (!success && onerror) success = onerror(r, node, i); |
| 2512 | if (err) { |
| 2513 | if (!success) |
| 2514 | CLUSTER_MANAGER_PRINT_REPLY_ERROR(node, err); |
| 2515 | zfree(err); |
| 2516 | } |
| 2517 | if (!success) break; |
| 2518 | } |
| 2519 | } |
| 2520 | cleanup: |
| 2521 | if (reply) freeReplyObject(reply); |
| 2522 | return success; |
| 2523 | } |
| 2524 | |
| 2525 | static int clusterManagerNodeConnect(clusterManagerNode *node) { |
| 2526 | if (node->context) redisFree(node->context); |
no test coverage detected