Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.h1
-rw-r--r--library.c5
-rw-r--r--redis_sentinel.c1
3 files changed, 6 insertions, 1 deletions
diff --git a/common.h b/common.h
index f2774896..5a6f02bf 100644
--- a/common.h
+++ b/common.h
@@ -332,6 +332,7 @@ typedef struct {
int reply_literal;
int null_mbulk_as_null;
int tcp_keepalive;
+ int sentinel;
} RedisSock;
/* }}} */
diff --git a/library.c b/library.c
index 440306ea..0590dce0 100644
--- a/library.c
+++ b/library.c
@@ -2340,7 +2340,10 @@ redis_sock_check_liveness(RedisSock *redis_sock)
}
/* check echo response */
- if (*inbuf != TYPE_BULK || atoi(inbuf + 1) != idlen ||
+ if ((redis_sock->sentinel && (
+ strncmp(inbuf, "-ERR unknown command", 20) != 0 ||
+ strstr(inbuf, id) == NULL
+ )) || *inbuf != TYPE_BULK || atoi(inbuf + 1) != idlen ||
redis_sock_gets(redis_sock, inbuf, sizeof(inbuf) - 1, &len) < 0 ||
strncmp(inbuf, id, idlen) != 0
) {
diff --git a/redis_sentinel.c b/redis_sentinel.c
index ca72640e..632975cd 100644
--- a/redis_sentinel.c
+++ b/redis_sentinel.c
@@ -87,6 +87,7 @@ PHP_METHOD(RedisSentinel, __construct)
if (auth) {
redis_sock_set_auth_zval(obj->sock, auth);
}
+ obj->sock->sentinel = 1;
}
PHP_METHOD(RedisSentinel, ckquorum)