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
d96a66f5
Commit
d96a66f5
authored
Feb 12, 2013
by
antirez
Browse files
Replication: more strict error checking for master PING reply.
parent
31f0a6ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/replication.c
View file @
d96a66f5
...
@@ -1058,11 +1058,16 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -1058,11 +1058,16 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
goto
error
;
goto
error
;
}
}
/* We don't care about the reply, it can be +PONG or an error since
/* We accept only two replies as valid, a positive +PONG reply
* the server requires AUTH. As long as it replies correctly, it's
* (we just check for "+") or an authentication error.
* fine from our point of view. */
* Note that older versions of Redis replied with "operation not
if
(
buf
[
0
]
!=
'-'
&&
buf
[
0
]
!=
'+'
)
{
* permitted" instead of using a proper error code, so we test
redisLog
(
REDIS_WARNING
,
"Unexpected reply to PING from master."
);
* both. */
if
(
buf
[
0
]
!=
'+'
&&
strncmp
(
buf
,
"-NOAUTH"
,
7
)
!=
0
&&
strncmp
(
buf
,
"-ERR operation not permitted"
,
28
)
!=
0
)
{
redisLog
(
REDIS_WARNING
,
"Error reply to PING from master: '%s'"
,
buf
);
goto
error
;
goto
error
;
}
else
{
}
else
{
redisLog
(
REDIS_NOTICE
,
redisLog
(
REDIS_NOTICE
,
...
...
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