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
cf3f0c01
Commit
cf3f0c01
authored
Mar 23, 2009
by
antirez
Browse files
Now MONITOR/SYNC cannot be issued multiple times
parent
87eca727
Changes
2
Hide whitespace changes
Inline
Side-by-side
TODO
View file @
cf3f0c01
...
@@ -34,3 +34,5 @@ ROLLBACK command:
...
@@ -34,3 +34,5 @@ ROLLBACK command:
COMMIT
COMMIT
but this sucks since there is no way to check the error message.
but this sucks since there is no way to check the error message.
- Prevent the client to issue SYNC or MONITOR multiple times
redis.c
View file @
cf3f0c01
...
@@ -2919,6 +2919,9 @@ static void syncCommand(redisClient *c) {
...
@@ -2919,6 +2919,9 @@ static void syncCommand(redisClient *c) {
time_t
start
=
time
(
NULL
);
time_t
start
=
time
(
NULL
);
char
sizebuf
[
32
];
char
sizebuf
[
32
];
/* ignore SYNC if aleady slave or in monitor mode */
if
(
c
->
flags
&
REDIS_SLAVE
)
return
;
redisLog
(
REDIS_NOTICE
,
"Slave ask for syncronization"
);
redisLog
(
REDIS_NOTICE
,
"Slave ask for syncronization"
);
if
(
flushClientOutput
(
c
)
==
REDIS_ERR
||
saveDb
(
server
.
dbfilename
)
!=
REDIS_OK
)
if
(
flushClientOutput
(
c
)
==
REDIS_ERR
||
saveDb
(
server
.
dbfilename
)
!=
REDIS_OK
)
goto
closeconn
;
goto
closeconn
;
...
@@ -3029,6 +3032,9 @@ static int syncWithMaster(void) {
...
@@ -3029,6 +3032,9 @@ static int syncWithMaster(void) {
}
}
static
void
monitorCommand
(
redisClient
*
c
)
{
static
void
monitorCommand
(
redisClient
*
c
)
{
/* ignore MONITOR if aleady slave or in monitor mode */
if
(
c
->
flags
&
REDIS_SLAVE
)
return
;
c
->
flags
|=
(
REDIS_SLAVE
|
REDIS_MONITOR
);
c
->
flags
|=
(
REDIS_SLAVE
|
REDIS_MONITOR
);
c
->
slaveseldb
=
0
;
c
->
slaveseldb
=
0
;
if
(
!
listAddNodeTail
(
server
.
monitors
,
c
))
oom
(
"listAddNodeTail"
);
if
(
!
listAddNodeTail
(
server
.
monitors
,
c
))
oom
(
"listAddNodeTail"
);
...
...
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