File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,7 @@ PHP_METHOD(Redis, __construct)
349
349
PHP_METHOD (Redis , connect )
350
350
{
351
351
zval * object ;
352
+ zval * * socket ;
352
353
int host_len , id ;
353
354
char * host = NULL ;
354
355
long port = -1 ;
@@ -371,6 +372,16 @@ PHP_METHOD(Redis, connect)
371
372
port = 6379 ;
372
373
}
373
374
375
+ /* if there is a redis sock already we have to remove it from the list */
376
+ if (redis_sock_get (object , & redis_sock TSRMLS_CC ) > 0 ) {
377
+ if (zend_hash_find (Z_OBJPROP_P (object ), "socket" ,
378
+ sizeof ("socket" ), (void * * ) & socket ) == FAILURE ) {
379
+ /* maybe there is a socket but the id isn't known.. what to do? */
380
+ } else {
381
+ zend_list_delete (Z_LVAL_PP (socket )); /* the refcount should be decreased and the detructor called */
382
+ }
383
+ }
384
+
374
385
redis_sock = redis_sock_create (host , host_len , port , timeout );
375
386
376
387
if (redis_sock_server_open (redis_sock , 1 TSRMLS_CC ) < 0 ) {
@@ -4479,5 +4490,5 @@ PHP_METHOD(Redis, slaveof)
4479
4490
}
4480
4491
/* }}} */
4481
4492
4482
- /* vim: set tabstop=4 expandtab : */
4493
+ /* vim: set tabstop=4 noexpandtab : */
4483
4494
You can’t perform that action at this time.
0 commit comments