Select RESP3 mode if redis-cli was started with the -3 option. */
| 834 | |
| 835 | /* Select RESP3 mode if redis-cli was started with the -3 option. */ |
| 836 | static int cliSwitchProto(void) { |
| 837 | redisReply *reply; |
| 838 | if (config.resp3 == 0) return REDIS_OK; |
| 839 | |
| 840 | reply = redisCommand(context,"HELLO 3"); |
| 841 | if (reply == NULL) { |
| 842 | fprintf(stderr, "\nI/O error\n"); |
| 843 | return REDIS_ERR; |
| 844 | } |
| 845 | |
| 846 | int result = REDIS_OK; |
| 847 | if (reply->type == REDIS_REPLY_ERROR) { |
| 848 | result = REDIS_ERR; |
| 849 | fprintf(stderr,"HELLO 3 failed: %s\n",reply->str); |
| 850 | } |
| 851 | freeReplyObject(reply); |
| 852 | return result; |
| 853 | } |
| 854 | |
| 855 | /* Connect to the server. It is possible to pass certain flags to the function: |
| 856 | * CC_FORCE: The connection is performed even if there is already |
no test coverage detected