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
bf821954
Commit
bf821954
authored
Mar 15, 2013
by
antirez
Browse files
Cluster: added function to broadcast pings.
See the function top-comment for info why this is useful sometimes.
parent
892e9854
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
bf821954
...
...
@@ -1193,6 +1193,27 @@ void clusterSendPing(clusterLink *link, int type) {
clusterSendMessage
(
link
,
buf
,
totlen
);
}
/* Send a PING packet to every connected node that's not in handshake state.
*
* Usually cluster nodes will ping just another node every second, however
* in Redis Cluster pings are not just used for failure detection, but also
* to carry important configuration informations. So broadcasting a ping is
* useful when something changes in the configuration and we want to make
* the cluster aware ASAP (for instance after a slave promotion). */
void
clusterBroadcastPing
(
void
)
{
dictIterator
*
di
;
dictEntry
*
de
;
di
=
dictGetIterator
(
server
.
cluster
->
nodes
);
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
clusterNode
*
node
=
dictGetVal
(
de
);
if
(
node
->
flags
&
(
REDIS_NODE_MYSELF
|
REDIS_NODE_HANDSHAKE
))
continue
;
clusterSendPing
(
node
->
link
,
CLUSTERMSG_TYPE_PONG
);
}
dictReleaseIterator
(
di
);
}
/* Send a PUBLISH message.
*
* If link is NULL, then the message is broadcasted to the whole cluster. */
...
...
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