diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2020-06-05 10:27:48 +0300 |
---|---|---|
committer | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2020-06-05 10:27:48 +0300 |
commit | 58dab5649fcc2cc63f5a29df83f783e154d7fa22 (patch) | |
tree | e223f86e37cd9d2d1422fc9af4bc1cd8075d49a5 /cluster_library.c | |
parent | 890ee0e656e545b18179cf247db94a33179ce1ab (diff) |
Store auth information in cluster->flags->auth
Diffstat (limited to 'cluster_library.c')
-rw-r--r-- | cluster_library.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/cluster_library.c b/cluster_library.c index b21a6875..0a54be3b 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -637,8 +637,8 @@ cluster_node_create(redisCluster *c, char *host, size_t host_len, node->sock = redis_sock_create(host, host_len, port, c->timeout, c->read_timeout, c->persistent, NULL, 0); - if (c->auth) { - node->sock->auth = zend_string_copy(c->auth); + if (c->flags->auth) { + node->sock->auth = zend_string_copy(c->flags->auth); } return node; @@ -826,7 +826,6 @@ PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout, c->read_timeout = read_timeout; c->failover = failover; c->persistent = persistent; - c->auth = NULL; c->err = NULL; /* Set up our waitms based on timeout */ @@ -851,6 +850,8 @@ cluster_free(redisCluster *c, int free_ctx) /* Free any allocated prefix */ if (c->flags->prefix) zend_string_release(c->flags->prefix); + /* Free auth info we've got */ + if (c->flags->auth) zend_string_release(c->flags->auth); efree(c->flags); /* Call hash table destructors */ @@ -861,9 +862,6 @@ cluster_free(redisCluster *c, int free_ctx) efree(c->seeds); efree(c->nodes); - /* Free auth info we've got */ - if (c->auth) zend_string_release(c->auth); - /* Free any error we've got */ if (c->err) zend_string_release(c->err); @@ -1089,8 +1087,8 @@ cluster_init_seeds(redisCluster *cluster, HashTable *ht_seeds) { cluster->read_timeout, cluster->persistent, NULL, 0); // Set auth information if specified - if (cluster->auth) { - redis_sock->auth = zend_string_copy(cluster->auth); + if (cluster->flags->auth) { + redis_sock->auth = zend_string_copy(cluster->flags->auth); } // Index this seed by host/port |