Skip to content

Commit 571dd96

Browse files
yatsukhnenkomichael-grunder
authored andcommitted
Check liveness via php_stream_set_option.
Check socket liveness using 0 second timeout before sync check.
1 parent 650ac05 commit 571dd96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,11 @@ redis_sock_check_liveness(RedisSock *redis_sock)
18071807
struct timeval tv;
18081808
size_t len;
18091809

1810+
/* Check socket liveness using 0 second timeout */
1811+
if (php_stream_set_option(redis_sock->stream, PHP_STREAM_OPTION_CHECK_LIVENESS, 0, NULL) != PHP_STREAM_OPTION_RETURN_OK) {
1812+
return FAILURE;
1813+
}
1814+
18101815
if (redis_sock->auth) {
18111816
redis_cmd_init_sstr(&cmd, 1, "AUTH", sizeof("AUTH") - 1);
18121817
redis_cmd_append_sstr(&cmd, ZSTR_VAL(redis_sock->auth), ZSTR_LEN(redis_sock->auth));

0 commit comments

Comments
 (0)