diff --git a/src/valkeycluster.c b/src/valkeycluster.c index 11287549..7ee8841b 100644 --- a/src/valkeycluster.c +++ b/src/valkeycluster.c @@ -1540,21 +1540,12 @@ void valkeyClusterFree(valkeyClusterContext *cc) { vk_free(cc); } -/* Connect to a Valkey cluster. On error the field error in the returned - * context will be set to the return value of the error function. - * When no set of reply functions is given, the default set will be used. */ -static valkeyClusterContext *_valkeyClusterConnect(valkeyClusterContext *cc, - const char *addrs) { - - int ret; - - ret = valkeyClusterSetOptionAddNodes(cc, addrs); - if (ret != VALKEY_OK) { +static valkeyClusterContext * +valkeyClusterConnectInternal(valkeyClusterContext *cc, const char *addrs) { + if (valkeyClusterSetOptionAddNodes(cc, addrs) != VALKEY_OK) { return cc; } - valkeyClusterUpdateSlotmap(cc); - return cc; } @@ -1569,7 +1560,7 @@ valkeyClusterContext *valkeyClusterConnect(const char *addrs, int flags) { cc->flags = flags; - return _valkeyClusterConnect(cc, addrs); + return valkeyClusterConnectInternal(cc, addrs); } valkeyClusterContext *valkeyClusterConnectWithTimeout(const char *addrs, @@ -1594,7 +1585,7 @@ valkeyClusterContext *valkeyClusterConnectWithTimeout(const char *addrs, memcpy(cc->connect_timeout, &tv, sizeof(struct timeval)); - return _valkeyClusterConnect(cc, addrs); + return valkeyClusterConnectInternal(cc, addrs); } int valkeyClusterSetOptionAddNode(valkeyClusterContext *cc, const char *addr) {