Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
6e9864fe
Commit
6e9864fe
authored
Jan 09, 2019
by
artix
Browse files
Cluster Manager: fix bus error in clusterManagerGetLinkStatus
parent
121adc60
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
6e9864fe
...
@@ -1994,6 +1994,15 @@ static dictType clusterManagerDictType = {
...
@@ -1994,6 +1994,15 @@ static dictType clusterManagerDictType = {
dictSdsDestructor /* val destructor */
dictSdsDestructor /* val destructor */
};
};
static dictType clusterManagerLinkDictType = {
dictSdsHash, /* hash function */
NULL, /* key dup */
NULL, /* val dup */
dictSdsKeyCompare, /* key compare */
dictSdsDestructor, /* key destructor */
dictListDestructor /* val destructor */
};
typedef int clusterManagerCommandProc(int argc, char **argv);
typedef int clusterManagerCommandProc(int argc, char **argv);
typedef int (*clusterManagerOnReplyError)(redisReply *reply,
typedef int (*clusterManagerOnReplyError)(redisReply *reply,
clusterManagerNode *n, int bulk_idx);
clusterManagerNode *n, int bulk_idx);
...
@@ -3889,7 +3898,7 @@ static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) {
...
@@ -3889,7 +3898,7 @@ static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) {
(strstr(link_status, "disconnected")));
(strstr(link_status, "disconnected")));
int handshaking = (strstr(flags, "handshake") != NULL);
int handshaking = (strstr(flags, "handshake") != NULL);
if (disconnected || handshaking) {
if (disconnected || handshaking) {
clusterManagerLink
*
link
=
zmalloc
(
sizeof
(
*
link
));
clusterManagerLink *link = zmalloc(sizeof(*link));
link->node_name = sdsnew(nodename);
link->node_name = sdsnew(nodename);
link->node_addr = sdsnew(addr);
link->node_addr = sdsnew(addr);
link->connected = 0;
link->connected = 0;
...
@@ -3902,15 +3911,12 @@ cleanup:
...
@@ -3902,15 +3911,12 @@ cleanup:
return links;
return links;
}
}
/* Check for disconnected cluster links. It returns a dict whose keys
/* Check for disconnected cluster links. It returns a dict whose keys
* are the unreachable node addresses and the values are lists of
* are the unreachable node addresses and the values are lists of
* node addresses that cannot reach the unreachable node. */
* node addresses that cannot reach the unreachable node. */
static dict *clusterManagerGetLinkStatus(void) {
static dict *clusterManagerGetLinkStatus(void) {
if (cluster_manager.nodes == NULL) return NULL;
if (cluster_manager.nodes == NULL) return NULL;
dictType
dtype
=
clusterManagerDictType
;
dict *status = dictCreate(&clusterManagerLinkDictType, NULL);
dtype
.
keyDestructor
=
dictSdsDestructor
;
dtype
.
valDestructor
=
dictListDestructor
;
dict
*
status
=
dictCreate
(
&
dtype
,
NULL
);
listIter li;
listIter li;
listNode *ln;
listNode *ln;
listRewind(cluster_manager.nodes, &li);
listRewind(cluster_manager.nodes, &li);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment