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
d6cc8867
Commit
d6cc8867
authored
Mar 29, 2010
by
antirez
Browse files
No timeouts nor other commands for clients in a Pub/Sub context
parent
ff767a75
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
d6cc8867
...
...
@@ -1152,7 +1152,8 @@ static void closeTimedoutClients(void) {
if
(
server
.
maxidletime
&&
!
(
c
->
flags
&
REDIS_SLAVE
)
&&
/* no timeout for slaves */
!
(
c
->
flags
&
REDIS_MASTER
)
&&
/* no timeout for masters */
(
now
-
c
->
lastinteraction
>
server
.
maxidletime
))
dictSize
(
c
->
pubsub_classes
)
==
0
&&
/* no timeout for pubsub */
(
now
-
c
->
lastinteraction
>
server
.
maxidletime
))
{
redisLog
(
REDIS_VERBOSE
,
"Closing idle client"
);
freeClient
(
c
);
...
...
@@ -2264,6 +2265,14 @@ static int processCommand(redisClient *c) {
return
1
;
}
/* Only allow SUBSCRIBE and UNSUBSCRIBE in the context of Pub/Sub */
if
(
dictSize
(
c
->
pubsub_classes
)
>
0
&&
cmd
->
proc
!=
subscribeCommand
&&
cmd
->
proc
!=
unsubscribeCommand
)
{
addReplySds
(
c
,
sdsnew
(
"-ERR only SUBSCRIBE / UNSUBSCRIBE / QUIT allowed in this context
\r\n
"
));
resetClient
(
c
);
return
1
;
}
/* Exec the command */
if
(
c
->
flags
&
REDIS_MULTI
&&
cmd
->
proc
!=
execCommand
&&
cmd
->
proc
!=
discardCommand
)
{
queueMultiCommand
(
c
,
cmd
);
...
...
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