Skip to content

Commit ae5469e

Browse files
committedSep 28, 2021
Review changes
See phpredis#2013
1 parent dfbbc84 commit ae5469e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎library.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,7 @@ static int redis_stream_liveness_check(php_stream *stream) {
21842184

21852185
/* Try to get the underlying socket FD for use with poll/select.
21862186
* Returns -1 on failure. */
2187-
static int redis_stream_fd_for_select(php_stream *stream) {
2187+
static php_socket_t redis_stream_fd_for_select(php_stream *stream) {
21882188
php_socket_t fd;
21892189
int flags;
21902190

@@ -2266,6 +2266,11 @@ redis_sock_check_liveness(RedisSock *redis_sock)
22662266
smart_string cmd = {0};
22672267
size_t len;
22682268

2269+
/* Short circuit if we detect the stream is "dirty", can't or are
2270+
configured not to try and fix it */
2271+
if (redis_stream_detect_dirty(redis_sock->stream) != SUCCESS)
2272+
goto failure;
2273+
22692274
/* Short circuit if we detect the stream has gone bad or if the user has
22702275
* configured persistent connection "YOLO mode". */
22712276
if (redis_stream_liveness_check(redis_sock->stream) != SUCCESS) {
@@ -2386,9 +2391,7 @@ PHP_REDIS_API int redis_sock_connect(RedisSock *redis_sock)
23862391
redis_sock->stream = *(php_stream **)zend_llist_get_last(&p->list);
23872392
zend_llist_remove_tail(&p->list);
23882393

2389-
if (redis_stream_detect_dirty(redis_sock->stream) == SUCCESS &&
2390-
redis_sock_check_liveness(redis_sock) == SUCCESS)
2391-
{
2394+
if (redis_sock_check_liveness(redis_sock) == SUCCESS) {
23922395
return SUCCESS;
23932396
}
23942397

0 commit comments

Comments
 (0)
Please sign in to comment.