Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2015-06-20 21:29:38 +0300
committermichael-grunder <michael.grunder@gmail.com>2015-06-20 21:29:38 +0300
commitc5811b1038649f861a29511b0ef8cf46df34ac66 (patch)
treeee944c5185203c5e2a2018795adc7c847c95d0f0 /cluster_library.c
parentece6c1d226ebf851bf247ca1b386d964387d21ef (diff)
Persistent connections for cluster and possible crash fix
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cluster_library.c b/cluster_library.c
index 6275080e..24e656e8 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -650,7 +650,7 @@ cluster_node_create(redisCluster *c, char *host, size_t host_len,
// Attach socket
node->sock = redis_sock_create(host, host_len, port, c->timeout,
- 0, NULL, 0, 1);
+ c->persistent, NULL, 0, 1);
return node;
}
@@ -799,7 +799,7 @@ static void ht_free_node(void *data) {
/* Construct a redisCluster object */
PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout,
- int failover)
+ int failover, int persistent)
{
redisCluster *c;
@@ -813,6 +813,7 @@ PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout,
c->timeout = timeout;
c->read_timeout = read_timeout;
c->failover = failover;
+ c->persistent = persistent;
/* Set up our waitms based on timeout */
c->waitms = (long)(1000 * timeout);
@@ -877,7 +878,8 @@ cluster_init_seeds(redisCluster *cluster, HashTable *ht_seeds) {
// Allocate a structure for this seed
redis_sock = redis_sock_create(str, psep-str,
- (unsigned short)atoi(psep+1),cluster->timeout,0,NULL,0,0);
+ (unsigned short)atoi(psep+1), cluster->timeout,
+ cluster->persistent, NULL, 0, 0);
// Index this seed by host/port
key_len = snprintf(key, sizeof(key), "%s:%u", redis_sock->host,