Add function to check if the reply reader is empty
This commit is contained in:
parent
e944ea3662
commit
b1fa529cf9
@ -326,6 +326,15 @@ void redisFreeReplyReader(void *reader) {
|
|||||||
free(r);
|
free(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int redisIsReplyReaderEmpty(void *reader) {
|
||||||
|
redisReader *r = reader;
|
||||||
|
if (r->buf != NULL && sdslen(r->buf) > 0)
|
||||||
|
return 0;
|
||||||
|
if (r->rlist != NULL && r->rpos < r->rlen)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void redisSetReplyReaderError(redisReader *r, redisReply *error) {
|
static void redisSetReplyReaderError(redisReader *r, redisReply *error) {
|
||||||
/* Clear remaining buffer when we see a protocol error. */
|
/* Clear remaining buffer when we see a protocol error. */
|
||||||
if (r->buf != NULL) {
|
if (r->buf != NULL) {
|
||||||
|
@ -54,6 +54,7 @@ void freeReplyObject(redisReply *r);
|
|||||||
redisReply *redisCommand(int fd, const char *format, ...);
|
redisReply *redisCommand(int fd, const char *format, ...);
|
||||||
void *redisCreateReplyReader();
|
void *redisCreateReplyReader();
|
||||||
void redisFreeReplyReader(void *ptr);
|
void redisFreeReplyReader(void *ptr);
|
||||||
|
int redisIsReplyReaderEmpty(void *ptr);
|
||||||
void *redisFeedReplyReader(void *reader, char *buf, int len);
|
void *redisFeedReplyReader(void *reader, char *buf, int len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user