Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
1c29aafd
Commit
1c29aafd
authored
May 25, 2011
by
Pieter Noordhuis
Browse files
Clarify rationale behind issue #43
parent
63dcf9b7
Changes
1
Show whitespace changes
Inline
Side-by-side
async.c
View file @
1c29aafd
...
@@ -361,13 +361,16 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
...
@@ -361,13 +361,16 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
/* Even if the context is subscribed, pending regular callbacks will
/* Even if the context is subscribed, pending regular callbacks will
* get a reply before pub/sub messages arrive. */
* get a reply before pub/sub messages arrive. */
if
(
__redisShiftCallback
(
&
ac
->
replies
,
&
cb
)
!=
REDIS_OK
)
{
if
(
__redisShiftCallback
(
&
ac
->
replies
,
&
cb
)
!=
REDIS_OK
)
{
// error reply before any callbacks were setup
/* A spontaneous reply in a not-subscribed context can only be the
* error reply that is sent when a new connection exceeds the
* maximum number of allowed connections on the server side. This
* is seen as an error instead of a regular reply because the
* server closes the connection after sending it. To prevent the
* error from being overwritten by an EOF error the connection is
* closed here. See issue #43. */
if
(
!
(
c
->
flags
&
REDIS_SUBSCRIBED
)
&&
((
redisReply
*
)
reply
)
->
type
==
REDIS_REPLY_ERROR
)
{
if
(
!
(
c
->
flags
&
REDIS_SUBSCRIBED
)
&&
((
redisReply
*
)
reply
)
->
type
==
REDIS_REPLY_ERROR
)
{
c
->
err
=
REDIS_ERR_OTHER
;
c
->
err
=
REDIS_ERR_OTHER
;
err_len
=
strlen
(((
redisReply
*
)
reply
)
->
str
);
snprintf
(
c
->
errstr
,
sizeof
(
c
->
errstr
),
"%s"
,((
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
);
__redisAsyncDisconnect
(
ac
);
return
;
return
;
}
}
...
...
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