summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-10-31 21:11:25 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-10-31 21:11:25 +0100
commit435e545dd2c5217bc070e009d2bf5201193da4aa (patch)
treea6bde9984a955b46e9ce0bcb9a432f5c8e9f5eba /hiredis.c
parent6042c569b1b364495235a87a3988ad99e3eb4dad (diff)
Fix redisGetReply
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/hiredis.c b/hiredis.c
index cf8f592..ae2d7aa 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -800,15 +800,11 @@ int redisGetReply(redisContext *c, void **reply) {
void *aux = NULL;
/* Try to read pending replies */
- if (__redisGetReply(c,&aux) == REDIS_ERR) {
+ if (__redisGetReply(c,&aux) == REDIS_ERR)
return REDIS_ERR;
- } else {
- /* Return immediately if there was a pending reply */
- if (aux != NULL) return REDIS_OK;
- }
/* For the blocking context, flush output buffer and read reply */
- if (c->flags & REDIS_BLOCK) {
+ if (aux == NULL && c->flags & REDIS_BLOCK) {
/* Write until done */
do {
if (redisBufferWrite(c,&wdone) == REDIS_ERR)
@@ -822,10 +818,10 @@ int redisGetReply(redisContext *c, void **reply) {
if (__redisGetReply(c,&aux) == REDIS_ERR)
return REDIS_ERR;
} while (aux == NULL);
-
- /* Set reply object */
- if (reply != NULL) *reply = aux;
}
+
+ /* Set reply object */
+ if (reply != NULL) *reply = aux;
return REDIS_OK;
}