summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-01-24 16:47:39 +0100
committerantirez <antirez@gmail.com>2018-03-15 12:54:10 +0100
commitbbec4569a57df0ee14e64f64caa6bb0b12c7f9db (patch)
treeacb842dc48aca45b6addb75c7206ec3ea1912691
parent41809fd969cb763c0323124aefaaaa2f5ab77839 (diff)
downloadredis-bbec4569a57df0ee14e64f64caa6bb0b12c7f9db.tar.gz
CG: Fix order of calls in streamReplyWithRange().
We need to check if we are going to serve the request via the PEL before inserting a deferred array len in the client output buffer.
-rw-r--r--src/t_stream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index 605d3251b..1d1dd8943 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -694,7 +694,7 @@ size_t streamReplyWithRangeFromConsumerPEL(client *c, stream *s, streamID *start
* 'noack' is non-zero.
*/
size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end, size_t count, int rev, streamCG *group, streamConsumer *consumer, int noack) {
- void *arraylen_ptr = addDeferredMultiBulkLength(c);
+ void *arraylen_ptr;
size_t arraylen = 0;
streamIterator si;
int64_t numfields;
@@ -713,6 +713,7 @@ size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end
group,consumer);
}
+ arraylen_ptr = addDeferredMultiBulkLength(c);
streamIteratorStart(&si,s,start,end,rev);
while(streamIteratorGetID(&si,&id,&numfields)) {
/* Update the group last_id if needed. */