Select RESP3 mode if redis-cli was started with the -3 option. */
| 641 | |
| 642 | /* Select RESP3 mode if redis-cli was started with the -3 option. */ |
| 643 | static int cliSwitchProto(void) { |
| 644 | redisReply *reply; |
| 645 | if (config.resp3 == 0) return REDIS_OK; |
| 646 | |
| 647 | reply = redisCommand(context,"HELLO 3"); |
| 648 | if (reply == NULL) { |
| 649 | fprintf(stderr, "\nI/O error\n"); |
| 650 | return REDIS_ERR; |
| 651 | } |
| 652 | |
| 653 | int result = REDIS_OK; |
| 654 | if (reply->type == REDIS_REPLY_ERROR) { |
| 655 | result = REDIS_ERR; |
| 656 | fprintf(stderr,"HELLO 3 failed: %s\n",reply->str); |
| 657 | } |
| 658 | freeReplyObject(reply); |
| 659 | return result; |
| 660 | } |
| 661 | |
| 662 | /* Connect to the server. It is possible to pass certain flags to the function: |
| 663 | * CC_FORCE: The connection is performed even if there is already |
no test coverage detected