From c5811b1038649f861a29511b0ef8cf46df34ac66 Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Sat, 20 Jun 2015 11:29:38 -0700 Subject: Persistent connections for cluster and possible crash fix --- cluster_library.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cluster_library.c') 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, -- cgit v1.2.3