File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -209,17 +209,16 @@ redis_pool_get_sock(redis_pool *pool, const char *key TSRMLS_DC) {
209209 if (rpm -> auth && rpm -> redis_sock -> status != REDIS_SOCK_STATUS_CONNECTED ) {
210210 needs_auth = 1 ;
211211 }
212- if (redis_sock_server_open (rpm -> redis_sock TSRMLS_CC ) < 0 ) {
213- continue ;
214- }
215- if (needs_auth ) {
216- redis_pool_member_auth (rpm TSRMLS_CC );
217- }
218- if (rpm -> database >= 0 ) { /* default is -1 which leaves the choice to redis. */
219- redis_pool_member_select (rpm TSRMLS_CC );
220- }
212+ if (redis_sock_server_open (rpm -> redis_sock TSRMLS_CC ) == 0 ) {
213+ if (needs_auth ) {
214+ redis_pool_member_auth (rpm TSRMLS_CC );
215+ }
216+ if (rpm -> database >= 0 ) { /* default is -1 which leaves the choice to redis. */
217+ redis_pool_member_select (rpm TSRMLS_CC );
218+ }
221219
222- return rpm ;
220+ return rpm ;
221+ }
223222 }
224223 i += rpm -> weight ;
225224 rpm = rpm -> next ;
@@ -546,11 +545,13 @@ PS_CLOSE_FUNC(redis)
546545 redis_pool * pool = PS_GET_MOD_DATA ();
547546
548547 if (pool ) {
549- redis_pool_member * rpm = redis_pool_get_sock (pool , ZSTR_VAL (pool -> lock_status .session_key ) TSRMLS_CC );
548+ if (pool -> lock_status .session_key ) {
549+ redis_pool_member * rpm = redis_pool_get_sock (pool , ZSTR_VAL (pool -> lock_status .session_key ) TSRMLS_CC );
550550
551- RedisSock * redis_sock = rpm ? rpm -> redis_sock : NULL ;
552- if (redis_sock ) {
553- lock_release (redis_sock , & pool -> lock_status TSRMLS_CC );
551+ RedisSock * redis_sock = rpm ? rpm -> redis_sock : NULL ;
552+ if (redis_sock ) {
553+ lock_release (redis_sock , & pool -> lock_status TSRMLS_CC );
554+ }
554555 }
555556
556557 redis_pool_free (pool TSRMLS_CC );
You can’t perform that action at this time.
0 commit comments