From c917e35c49cabac8fb4de0dbbb856c07f03f324d Mon Sep 17 00:00:00 2001 From: sundb Date: Sun, 10 Jan 2021 02:24:58 +0800 Subject: [PATCH] Assert that clusterAddNode can't fail (#8296) Assert that clusterAddNode can't fail --- src/cluster.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index c327334ee..78c36e8d1 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -47,7 +47,7 @@ clusterNode *myself = NULL; clusterNode *createClusterNode(char *nodename, int flags); -int clusterAddNode(clusterNode *node); +void clusterAddNode(clusterNode *node); void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask); void clusterReadHandler(connection *conn); void clusterSendPing(clusterLink *link, int type); @@ -961,12 +961,12 @@ void freeClusterNode(clusterNode *n) { } /* Add a node to the nodes hash table */ -int clusterAddNode(clusterNode *node) { +void clusterAddNode(clusterNode *node) { int retval; retval = dictAdd(server.cluster->nodes, sdsnewlen(node->name,CLUSTER_NAMELEN), node); - return (retval == DICT_OK) ? C_OK : C_ERR; + serverAssert(retval == DICT_OK); } /* Remove a node from the cluster. The function performs the high level