diff options
-rw-r--r-- | common.h | 1 | ||||
-rw-r--r-- | library.c | 5 | ||||
-rw-r--r-- | redis_sentinel.c | 1 |
3 files changed, 6 insertions, 1 deletions
@@ -332,6 +332,7 @@ typedef struct { int reply_literal; int null_mbulk_as_null; int tcp_keepalive; + int sentinel; } RedisSock; /* }}} */ @@ -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) |