In cluster, if server replies ASK, we will redirect to a different node. * Before sending the real command, we need to send ASKING command first. */
| 928 | /* In cluster, if server replies ASK, we will redirect to a different node. |
| 929 | * Before sending the real command, we need to send ASKING command first. */ |
| 930 | static int cliSendAsking() { |
| 931 | redisReply *reply; |
| 932 | |
| 933 | config.cluster_send_asking = 0; |
| 934 | if (context == NULL) { |
| 935 | return REDIS_ERR; |
| 936 | } |
| 937 | reply = redisCommand(context,"ASKING"); |
| 938 | if (reply == NULL) { |
| 939 | fprintf(stderr, "\nI/O error\n"); |
| 940 | return REDIS_ERR; |
| 941 | } |
| 942 | int result = REDIS_OK; |
| 943 | if (reply->type == REDIS_REPLY_ERROR) { |
| 944 | result = REDIS_ERR; |
| 945 | fprintf(stderr,"ASKING failed: %s\n",reply->str); |
| 946 | } |
| 947 | freeReplyObject(reply); |
| 948 | return result; |
| 949 | } |
| 950 | |
| 951 | static void cliPrintContextError(void) { |
| 952 | if (context == NULL) return; |
no test coverage detected