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
437fc2cb
Commit
437fc2cb
authored
Jan 20, 2014
by
antirez
Browse files
Cluster: fix error reporting when slaveof is found in config.
parent
ac3850ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
437fc2cb
...
...
@@ -82,6 +82,7 @@ void resetServerSaveParams() {
void
loadServerConfigFromString
(
char
*
config
)
{
char
*
err
=
NULL
;
int
linenum
=
0
,
totlines
,
i
;
int
slaveof_linenum
=
0
;
sds
*
lines
;
lines
=
sdssplitlen
(
config
,
strlen
(
config
),
"
\n
"
,
1
,
&
totlines
);
...
...
@@ -244,6 +245,7 @@ void loadServerConfigFromString(char *config) {
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"slaveof"
)
&&
argc
==
3
)
{
slaveof_linenum
=
linenum
;
server
.
masterhost
=
sdsnew
(
argv
[
1
]);
server
.
masterport
=
atoi
(
argv
[
2
]);
server
.
repl_state
=
REDIS_REPL_CONNECT
;
...
...
@@ -490,13 +492,16 @@ void loadServerConfigFromString(char *config) {
}
sdsfreesplitres
(
argv
,
argc
);
}
sdsfreesplitres
(
lines
,
totlines
);
/* Sanity checks. */
if
(
server
.
cluster_enabled
&&
server
.
masterhost
)
{
linenum
=
slaveof_linenum
;
i
=
linenum
-
1
;
err
=
"slaveof directive not allowed in cluster mode"
;
goto
loaderr
;
}
sdsfreesplitres
(
lines
,
totlines
);
return
;
loaderr:
...
...
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