File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2118,13 +2118,26 @@ static int redis_uniqid(char *buf, size_t buflen) {
21182118                    (long )tv .tv_sec , (long )tv .tv_usec , (long )php_rand ());
21192119}
21202120
2121+ static  int  redis_stream_liveness_check (php_stream  * stream ) {
2122+     return  php_stream_set_option (stream , PHP_STREAM_OPTION_CHECK_LIVENESS ,
2123+                                  0 , NULL ) ==  PHP_STREAM_OPTION_RETURN_OK  ?
2124+                                  SUCCESS  : FAILURE ;
2125+ }
2126+ 
21212127static  int 
21222128redis_sock_check_liveness (RedisSock  * redis_sock )
21232129{
21242130    char  id [64 ], ok ;
21252131    int  idlen , auth ;
21262132    smart_string  cmd  =  {0 };
21272133
2134+     /* Short circuit if we detect the stream has gone bad or if the user has 
2135+      * configured persistent connection "YOLO mode". */ 
2136+     if  (redis_stream_liveness_check (redis_sock -> stream ) !=  SUCCESS )
2137+         return  FAILURE ;
2138+     else  if  (!INI_INT ("redis.pconnect.echo_check_liveness" ))
2139+         return  SUCCESS ;
2140+ 
21282141    /* AUTH (if we need it) */ 
21292142    auth  =  redis_sock_append_auth (redis_sock , & cmd );
21302143
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ PHP_INI_BEGIN()
9696    /* redis pconnect */ 
9797    PHP_INI_ENTRY ("redis.pconnect.pooling_enabled" , "1" , PHP_INI_ALL , NULL )
9898    PHP_INI_ENTRY ("redis.pconnect.connection_limit" , "0" , PHP_INI_ALL , NULL )
99+     PHP_INI_ENTRY ("redis.pconnect.echo_check_liveness" , "1" , PHP_INI_ALL , NULL )
99100    PHP_INI_ENTRY ("redis.pconnect.pool_pattern" , "" , PHP_INI_ALL , NULL )
100101
101102    /* redis session */ 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments