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
72688572
Commit
72688572
authored
May 24, 2011
by
Blake Matheny
Browse files
Fix the case where an error reply is received before any callbacks are registered
parent
82ad9444
Changes
1
Show whitespace changes
Inline
Side-by-side
async.c
View file @
72688572
...
...
@@ -361,7 +361,17 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
/* Even if the context is subscribed, pending regular callbacks will
* get a reply before pub/sub messages arrive. */
if
(
__redisShiftCallback
(
&
ac
->
replies
,
&
cb
)
!=
REDIS_OK
)
{
/* No more regular callbacks, the context *must* be subscribed. */
// error reply before any callbacks were setup
if
(
((
redisReply
*
)
reply
)
->
type
==
REDIS_REPLY_ERROR
)
{
c
->
err
=
REDIS_ERR_OTHER
;
err_len
=
strlen
(((
redisReply
*
)
reply
)
->
str
);
err_len
=
err_len
<
(
sizeof
(
c
->
errstr
)
-
1
)
?
err_len
:
(
sizeof
(
c
->
errstr
)
-
1
);
memcpy
(
c
->
errstr
,
((
redisReply
*
)
reply
)
->
str
,
err_len
);
c
->
errstr
[
err_len
]
=
'\0'
;
__redisAsyncDisconnect
(
ac
);
return
;
}
/* No more regular callbacks and no errors, the context *must* be subscribed. */
assert
(
c
->
flags
&
REDIS_SUBSCRIBED
);
__redisGetSubscribeCallback
(
ac
,
reply
,
&
cb
);
}
...
...
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