| 2052 | } |
| 2053 | |
| 2054 | static int issueCommandRepeat(int argc, char **argv, long repeat) { |
| 2055 | while (1) { |
| 2056 | if (config.cluster_reissue_command || context == NULL || |
| 2057 | context->err == REDIS_ERR_IO || context->err == REDIS_ERR_EOF) |
| 2058 | { |
| 2059 | if (cliConnect(CC_FORCE) != REDIS_OK) { |
| 2060 | cliPrintContextError(); |
| 2061 | config.cluster_reissue_command = 0; |
| 2062 | return REDIS_ERR; |
| 2063 | } |
| 2064 | } |
| 2065 | config.cluster_reissue_command = 0; |
| 2066 | if (config.cluster_send_asking) { |
| 2067 | if (cliSendAsking() != REDIS_OK) { |
| 2068 | cliPrintContextError(); |
| 2069 | return REDIS_ERR; |
| 2070 | } |
| 2071 | } |
| 2072 | if (cliSendCommand(argc,argv,repeat) != REDIS_OK) { |
| 2073 | cliPrintContextError(); |
| 2074 | return REDIS_ERR; |
| 2075 | } |
| 2076 | |
| 2077 | /* Issue the command again if we got redirected in cluster mode */ |
| 2078 | if (config.cluster_mode && config.cluster_reissue_command) { |
| 2079 | continue; |
| 2080 | } |
| 2081 | break; |
| 2082 | } |
| 2083 | return REDIS_OK; |
| 2084 | } |
| 2085 | |
| 2086 | static int issueCommand(int argc, char **argv) { |
| 2087 | return issueCommandRepeat(argc, argv, config.repeat); |
no test coverage detected