Fix redisGetReply

This commit is contained in:
Pieter Noordhuis 2010-10-31 21:11:25 +01:00
parent 6042c569b1
commit 435e545dd2

View File

@ -800,15 +800,11 @@ int redisGetReply(redisContext *c, void **reply) {
void *aux = NULL; void *aux = NULL;
/* Try to read pending replies */ /* Try to read pending replies */
if (__redisGetReply(c,&aux) == REDIS_ERR) { if (__redisGetReply(c,&aux) == REDIS_ERR)
return 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 */ /* 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 */ /* Write until done */
do { do {
if (redisBufferWrite(c,&wdone) == REDIS_ERR) if (redisBufferWrite(c,&wdone) == REDIS_ERR)
@ -822,10 +818,10 @@ int redisGetReply(redisContext *c, void **reply) {
if (__redisGetReply(c,&aux) == REDIS_ERR) if (__redisGetReply(c,&aux) == REDIS_ERR)
return REDIS_ERR; return REDIS_ERR;
} while (aux == NULL); } while (aux == NULL);
}
/* Set reply object */ /* Set reply object */
if (reply != NULL) *reply = aux; if (reply != NULL) *reply = aux;
}
return REDIS_OK; return REDIS_OK;
} }