Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42cbd88

Browse files
committed
Issue #1974
1 parent 79313e7 commit 42cbd88

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ typedef struct {
332332
int reply_literal;
333333
int null_mbulk_as_null;
334334
int tcp_keepalive;
335+
int sentinel;
335336
} RedisSock;
336337
/* }}} */
337338

library.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2340,7 +2340,10 @@ redis_sock_check_liveness(RedisSock *redis_sock)
23402340
}
23412341

23422342
/* check echo response */
2343-
if (*inbuf != TYPE_BULK || atoi(inbuf + 1) != idlen ||
2343+
if ((redis_sock->sentinel && (
2344+
strncmp(inbuf, "-ERR unknown command", 20) != 0 ||
2345+
strstr(inbuf, id) == NULL
2346+
)) || *inbuf != TYPE_BULK || atoi(inbuf + 1) != idlen ||
23442347
redis_sock_gets(redis_sock, inbuf, sizeof(inbuf) - 1, &len) < 0 ||
23452348
strncmp(inbuf, id, idlen) != 0
23462349
) {

redis_sentinel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ PHP_METHOD(RedisSentinel, __construct)
8787
if (auth) {
8888
redis_sock_set_auth_zval(obj->sock, auth);
8989
}
90+
obj->sock->sentinel = 1;
9091
}
9192

9293
PHP_METHOD(RedisSentinel, ckquorum)

0 commit comments

Comments
 (0)