@@ -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
@@ -2865,7 +2865,7 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
28652865PHP_REDIS_API int
28662866redis_sock_write (RedisSock * redis_sock , char * cmd , size_t sz )
28672867{
2868- if (redis_check_eof (redis_sock , 0 ) == 0 &&
2868+ if (redis_check_eof (redis_sock , 0 , 0 ) == 0 &&
28692869 php_stream_write (redis_sock -> stream , cmd , sz ) == sz
28702870 ) {
28712871 return sz ;
@@ -3343,7 +3343,7 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
33433343 size_t * line_size )
33443344{
33453345 // Handle EOF
3346- if (-1 == redis_check_eof (redis_sock , 0 )) {
3346+ if (-1 == redis_check_eof (redis_sock , 1 , 0 )) {
33473347 return -1 ;
33483348 }
33493349
@@ -3376,7 +3376,7 @@ redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type,
33763376 long * reply_info )
33773377{
33783378 // Make sure we haven't lost the connection, even trying to reconnect
3379- if (-1 == redis_check_eof (redis_sock , 0 )) {
3379+ if (-1 == redis_check_eof (redis_sock , 1 , 0 )) {
33803380 // Failure
33813381 * reply_type = EOF ;
33823382 return -1 ;
0 commit comments