From 09f0916f36cde9cc2637cd01a021895ba0981e27 Mon Sep 17 00:00:00 2001 From: baiyang Date: Thu, 21 Sep 2023 10:02:42 +0800 Subject: [PATCH] fix stream while max_buf_size < 0 (#2360) --- src/brpc/stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/brpc/stream.cpp b/src/brpc/stream.cpp index 8b346bd628..47d776d5c7 100644 --- a/src/brpc/stream.cpp +++ b/src/brpc/stream.cpp @@ -74,7 +74,7 @@ int Stream::Create(const StreamOptions &options, s->_connected = false; s->_options = options; s->_closed = false; - s->_cur_buf_size = options.max_buf_size; + s->_cur_buf_size = options.max_buf_size > 0 ? options.max_buf_size : 0; if (options.max_buf_size > 0 && options.min_buf_size > options.max_buf_size) { // set 0 if min_buf_size is invalid. s->_options.min_buf_size = 0;