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
6531c94d
Commit
6531c94d
authored
May 26, 2010
by
antirez
Browse files
raise error on nested MULTI and WATCH inside multi
parent
bc000c1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
6531c94d
...
...
@@ -2446,7 +2446,10 @@ static int processCommand(redisClient *c) {
}
/* Exec the command */
if
(
c
->
flags
&
REDIS_MULTI
&&
cmd
->
proc
!=
execCommand
&&
cmd
->
proc
!=
discardCommand
)
{
if
(
c
->
flags
&
REDIS_MULTI
&&
cmd
->
proc
!=
execCommand
&&
cmd
->
proc
!=
discardCommand
&&
cmd
->
proc
!=
multiCommand
&&
cmd
->
proc
!=
watchCommand
)
{
queueMultiCommand
(
c
,
cmd
);
addReply
(
c
,
shared
.
queued
);
}
else
{
...
...
@@ -7498,6 +7501,10 @@ static void queueMultiCommand(redisClient *c, struct redisCommand *cmd) {
}
static
void
multiCommand
(
redisClient
*
c
)
{
if
(
c
->
flags
&
REDIS_MULTI
)
{
addReplySds
(
c
,
sdsnew
(
"-ERR MULTI calls can not be nested
\r\n
"
));
return
;
}
c
->
flags
|=
REDIS_MULTI
;
addReply
(
c
,
shared
.
ok
);
}
...
...
@@ -10513,6 +10520,10 @@ static void touchWatchedKeysOnFlush(int dbid) {
static
void
watchCommand
(
redisClient
*
c
)
{
int
j
;
if
(
c
->
flags
&
REDIS_MULTI
)
{
addReplySds
(
c
,
sdsnew
(
"-ERR WATCH inside MULTI is not allowed
\r\n
"
));
return
;
}
for
(
j
=
1
;
j
<
c
->
argc
;
j
++
)
watchForKey
(
c
,
c
->
argv
[
j
]);
addReply
(
c
,
shared
.
ok
);
...
...
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