Commit 5a9bc7cc authored by antirez's avatar antirez
Browse files

replicationHandleMasterDisconnection() belongs to replication.c.

parent 0b765249
...@@ -667,20 +667,6 @@ void disconnectSlaves(void) { ...@@ -667,20 +667,6 @@ void disconnectSlaves(void) {
} }
} }
/* This function is called when the slave lose the connection with the
* master into an unexpected way. */
void replicationHandleMasterDisconnection(void) {
server.master = NULL;
server.repl_state = REDIS_REPL_CONNECT;
server.repl_down_since = server.unixtime;
/* We lost connection with our master, force our slaves to resync
* with us as well to load the new data set.
*
* If server.masterhost is NULL the user called SLAVEOF NO ONE so
* slave resync is not needed. */
if (server.masterhost != NULL) disconnectSlaves();
}
void freeClient(redisClient *c) { void freeClient(redisClient *c) {
listNode *ln; listNode *ln;
......
...@@ -1657,6 +1657,20 @@ void replicationUnsetMaster(void) { ...@@ -1657,6 +1657,20 @@ void replicationUnsetMaster(void) {
server.repl_state = REDIS_REPL_NONE; server.repl_state = REDIS_REPL_NONE;
} }
/* This function is called when the slave lose the connection with the
* master into an unexpected way. */
void replicationHandleMasterDisconnection(void) {
server.master = NULL;
server.repl_state = REDIS_REPL_CONNECT;
server.repl_down_since = server.unixtime;
/* We lost connection with our master, force our slaves to resync
* with us as well to load the new data set.
*
* If server.masterhost is NULL the user called SLAVEOF NO ONE so
* slave resync is not needed. */
if (server.masterhost != NULL) disconnectSlaves();
}
void slaveofCommand(redisClient *c) { void slaveofCommand(redisClient *c) {
/* SLAVEOF is not allowed in cluster mode as replication is automatically /* SLAVEOF is not allowed in cluster mode as replication is automatically
* configured using the current address of the master node. */ * configured using the current address of the master node. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment