}
int _ensureFileEvent(redisClient *c) {
+ if (c->fd <= 0) return REDIS_ERR;
if (c->bufpos == 0 && listLength(c->reply) == 0 &&
(c->replstate == REDIS_REPL_NONE ||
c->replstate == REDIS_REPL_ONLINE) &&
}
void addReplySds(redisClient *c, sds s) {
- if (_ensureFileEvent(c) != REDIS_OK) return;
+ if (_ensureFileEvent(c) != REDIS_OK) {
+ /* The caller expects the sds to be free'd. */
+ sdsfree(s);
+ return;
+ }
if (sdslen(s) < REDIS_REPLY_CHUNK_THRESHOLD) {
_addReplyStringToBuffer(c,s,sdslen(s));
sdsfree(s);
_addReplyLongLong(c,ll,':');
}
-void addReplyUlong(redisClient *c, unsigned long ul) {
- _addReplyLongLong(c,(long long)ul,':');
+void addReplyMultiBulkLen(redisClient *c, long length) {
+ _addReplyLongLong(c,length,'*');
}
void addReplyBulkLen(redisClient *c, robj *obj) {