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
hiredis
Commits
63e34f5f
Commit
63e34f5f
authored
Jul 11, 2012
by
Pieter Noordhuis
Browse files
Merge pull request #112 from nessence/master
MONITOR causes assertion failure, async.c, line 398.
parents
f8debbfd
01cce89d
Changes
2
Hide whitespace changes
Inline
Side-by-side
async.c
View file @
63e34f5f
...
@@ -372,6 +372,11 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
...
@@ -372,6 +372,11 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
__redisAsyncDisconnect
(
ac
);
__redisAsyncDisconnect
(
ac
);
return
;
return
;
}
}
/* If monitor mode, repush callback */
if
(
c
->
flags
&
REDIS_MONITORING
)
{
__redisPushCallback
(
&
ac
->
replies
,
&
cb
);
}
/* When the connection is not being disconnected, simply stop
/* When the connection is not being disconnected, simply stop
* trying to get replies and wait for the next loop tick. */
* trying to get replies and wait for the next loop tick. */
...
@@ -394,9 +399,10 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
...
@@ -394,9 +399,10 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
__redisAsyncDisconnect
(
ac
);
__redisAsyncDisconnect
(
ac
);
return
;
return
;
}
}
/* No more regular callbacks and no errors, the context *must* be subscribed. */
/* No more regular callbacks and no errors, the context *must* be subscribed or monitoring. */
assert
(
c
->
flags
&
REDIS_SUBSCRIBED
);
assert
((
c
->
flags
&
REDIS_SUBSCRIBED
||
c
->
flags
&
REDIS_MONITORING
));
__redisGetSubscribeCallback
(
ac
,
reply
,
&
cb
);
if
(
c
->
flags
&
REDIS_SUBSCRIBED
)
__redisGetSubscribeCallback
(
ac
,
reply
,
&
cb
);
}
}
if
(
cb
.
fn
!=
NULL
)
{
if
(
cb
.
fn
!=
NULL
)
{
...
@@ -557,6 +563,10 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void
...
@@ -557,6 +563,10 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void
/* (P)UNSUBSCRIBE does not have its own response: every channel or
/* (P)UNSUBSCRIBE does not have its own response: every channel or
* pattern that is unsubscribed will receive a message. This means we
* pattern that is unsubscribed will receive a message. This means we
* should not append a callback function for this command. */
* should not append a callback function for this command. */
}
else
if
(
strncasecmp
(
cstr
,
"monitor
\r\n
"
,
9
)
==
0
)
{
/* Set monitor flag and push callback */
c
->
flags
|=
REDIS_MONITORING
;
__redisPushCallback
(
&
ac
->
replies
,
&
cb
);
}
else
{
}
else
{
if
(
c
->
flags
&
REDIS_SUBSCRIBED
)
if
(
c
->
flags
&
REDIS_SUBSCRIBED
)
/* This will likely result in an error reply, but it needs to be
/* This will likely result in an error reply, but it needs to be
...
...
hiredis.h
View file @
63e34f5f
...
@@ -76,6 +76,9 @@
...
@@ -76,6 +76,9 @@
/* Flag that is set when the async context has one or more subscriptions. */
/* Flag that is set when the async context has one or more subscriptions. */
#define REDIS_SUBSCRIBED 0x20
#define REDIS_SUBSCRIBED 0x20
/* Flag that is set when monitor mode is active */
#define REDIS_MONITORING 0x40
#define REDIS_REPLY_STRING 1
#define REDIS_REPLY_STRING 1
#define REDIS_REPLY_ARRAY 2
#define REDIS_REPLY_ARRAY 2
#define REDIS_REPLY_INTEGER 3
#define REDIS_REPLY_INTEGER 3
...
...
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