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
278ea9d1
Commit
278ea9d1
authored
Jul 28, 2015
by
antirez
Browse files
replicationHandleMasterDisconnection() belongs to replication.c.
parent
54c71f2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
278ea9d1
...
@@ -674,20 +674,6 @@ void disconnectSlaves(void) {
...
@@ -674,20 +674,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
=
REPL_STATE_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
(
client
*
c
)
{
void
freeClient
(
client
*
c
)
{
listNode
*
ln
;
listNode
*
ln
;
...
...
src/replication.c
View file @
278ea9d1
...
@@ -1477,6 +1477,20 @@ void replicationUnsetMaster(void) {
...
@@ -1477,6 +1477,20 @@ void replicationUnsetMaster(void) {
server
.
repl_state
=
REPL_STATE_NONE
;
server
.
repl_state
=
REPL_STATE_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
=
REPL_STATE_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
(
client
*
c
)
{
void
slaveofCommand
(
client
*
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. */
...
...
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