@@ -287,7 +287,7 @@ redis_error_throw(RedisSock *redis_sock)
287287}
288288
289289PHP_REDIS_API int
290- redis_check_eof (RedisSock * redis_sock , int no_throw )
290+ redis_check_eof (RedisSock * redis_sock , zend_bool no_retry , zend_bool no_throw )
291291{
292292 unsigned int retry_index ;
293293 char * errmsg ;
@@ -322,7 +322,7 @@ redis_check_eof(RedisSock *redis_sock, int no_throw)
322322 } else {
323323 errmsg = "Connection lost" ;
324324 redis_backoff_reset (& redis_sock -> backoff );
325- for (retry_index = 0 ; retry_index < redis_sock -> max_retries ; ++ retry_index ) {
325+ for (retry_index = 0 ; ! no_retry && retry_index < redis_sock -> max_retries ; ++ retry_index ) {
326326 /* close existing stream before reconnecting */
327327 if (redis_sock -> stream ) {
328328 redis_sock_disconnect (redis_sock , 1 );
@@ -592,7 +592,7 @@ redis_sock_read_bulk_reply(RedisSock *redis_sock, int bytes)
592592 char * reply ;
593593 size_t got ;
594594
595- if (-1 == bytes || -1 == redis_check_eof (redis_sock , 0 )) {
595+ if (-1 == bytes || -1 == redis_check_eof (redis_sock , 1 , 0 )) {
596596 return NULL ;
597597 }
598598
@@ -2868,7 +2868,7 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
28682868PHP_REDIS_API int
28692869redis_sock_write (RedisSock * redis_sock , char * cmd , size_t sz )
28702870{
2871- if (redis_check_eof (redis_sock , 0 ) == 0 &&
2871+ if (redis_check_eof (redis_sock , 0 , 0 ) == 0 &&
28722872 php_stream_write (redis_sock -> stream , cmd , sz ) == sz
28732873 ) {
28742874 return sz ;
@@ -3346,7 +3346,7 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
33463346 size_t * line_size )
33473347{
33483348 // Handle EOF
3349- if (-1 == redis_check_eof (redis_sock , 0 )) {
3349+ if (-1 == redis_check_eof (redis_sock , 1 , 0 )) {
33503350 return -1 ;
33513351 }
33523352
@@ -3379,7 +3379,7 @@ redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type,
33793379 long * reply_info )
33803380{
33813381 // Make sure we haven't lost the connection, even trying to reconnect
3382- if (-1 == redis_check_eof (redis_sock , 0 )) {
3382+ if (-1 == redis_check_eof (redis_sock , 1 , 0 )) {
33833383 // Failure
33843384 * reply_type = EOF ;
33853385 return -1 ;
0 commit comments