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:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2018-08-21 16:50:53 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2018-08-22 09:02:31 +0300
commit1d997873750e5fdef1fe368b5296f4427dab3ea0 (patch)
tree73aaa6b05361a35c30b7a85d38dade44f320d678 /cluster_library.c
parent399edf44f90f5c0b7be4f3bdefb6b402eda5f0af (diff)
Change connect/reconnect logic
Persistant connections can be closed via close method. Connection marked as failed only after reconnection attempts.
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cluster_library.c b/cluster_library.c
index 0a93c4e6..0f4c915a 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -835,7 +835,7 @@ PHP_REDIS_API void
cluster_free(redisCluster *c, int free_ctx TSRMLS_DC)
{
/* Disconnect from each node we're connected to */
- cluster_disconnect(c TSRMLS_CC);
+ cluster_disconnect(c, 0 TSRMLS_CC);
/* Free any allocated prefix */
if (c->flags->prefix) zend_string_release(c->flags->prefix);
@@ -952,7 +952,7 @@ PHP_REDIS_API int cluster_map_keyspace(redisCluster *c TSRMLS_DC) {
memset(c->master, 0, sizeof(redisClusterNode*)*REDIS_CLUSTER_SLOTS);
}
}
- redis_sock_disconnect(seed TSRMLS_CC);
+ redis_sock_disconnect(seed, 0 TSRMLS_CC);
if (mapped) break;
} ZEND_HASH_FOREACH_END();
@@ -1070,12 +1070,12 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
}
/* Disconnect from each node we're connected to */
-PHP_REDIS_API void cluster_disconnect(redisCluster *c TSRMLS_DC) {
+PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force TSRMLS_DC) {
redisClusterNode *node;
ZEND_HASH_FOREACH_PTR(c->nodes, node) {
if (node == NULL) continue;
- redis_sock_disconnect(node->sock TSRMLS_CC);
+ redis_sock_disconnect(node->sock, force TSRMLS_CC);
node->sock->lazy_connect = 1;
} ZEND_HASH_FOREACH_END();
}
@@ -1302,7 +1302,7 @@ PHP_REDIS_API int cluster_abort_exec(redisCluster *c TSRMLS_DC) {
while (fi) {
if (SLOT_SOCK(c,fi->slot)->mode == MULTI) {
if (cluster_send_discard(c, fi->slot TSRMLS_CC) < 0) {
- cluster_disconnect(c TSRMLS_CC);
+ cluster_disconnect(c, 0 TSRMLS_CC);
return -1;
}
SLOT_SOCK(c,fi->slot)->mode = ATOMIC;