Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16185f2

Browse files
Re-add UNIX socket support to RedisArray
Merging the logic from ra-performance branch into feature/ra-performance
1 parent dcbeae7 commit 16185f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

redis_array_impl.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, long retry_interval TSRMLS_DC)
3636
int count = zend_hash_num_elements(hosts);
3737
char *host, *p;
3838
short port;
39-
zval **zpData, z_cons, z_ret;
39+
zval **zpData, *z_args, z_cons, z_ret;
4040
RedisSock *redis_sock = NULL;
4141

4242
/* function calls on the Redis object */
@@ -59,7 +59,9 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, long retry_interval TSRMLS_DC)
5959
if((p = strchr(host, ':'))) { /* found port */
6060
host_len = p - host;
6161
port = (short)atoi(p+1);
62-
}
62+
} else if(strchr(host,'/') != NULL) { /* unix socket */
63+
port = -1;
64+
}
6365

6466
/* create Redis object */
6567
MAKE_STD_ZVAL(ra->redis[i]);
@@ -68,7 +70,7 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, long retry_interval TSRMLS_DC)
6870
call_user_function(&redis_ce->function_table, &ra->redis[i], &z_cons, &z_ret, 0, NULL TSRMLS_CC);
6971

7072
/* create socket */
71-
redis_sock = redis_sock_create(host, host_len, port, 0, 0, NULL, retry_interval); /* TODO: persistence? */
73+
redis_sock = redis_sock_create(host, host_len, port, 0, ra->pconnect, NULL, retry_interval);
7274

7375
/* connect */
7476
redis_sock_server_open(redis_sock, 1 TSRMLS_CC);

0 commit comments

Comments
 (0)