wwbmmm commented on code in PR #2889: URL: https://github.com/apache/brpc/pull/2889#discussion_r1948071619
########## src/brpc/stream.cpp: ########## @@ -36,6 +36,18 @@ namespace brpc { DECLARE_bool(usercode_in_pthread); DECLARE_int64(socket_max_streams_unconsumed_bytes); +DEFINE_uint64(stream_write_max_segment_size, 512 * 1024 * 1024, + "Stream message exceeding this size will be automatically split into smaller segments"); + +static bool ValidateStreamWriteMaxSegmentSize(const char* flagname, uint64_t value) { Review Comment: 可以直接用 brpc::PositiveInteger ########## src/brpc/stream.cpp: ########## @@ -154,18 +173,54 @@ ssize_t Stream::CutMessageIntoFileDescriptor(int /*fd*/, } butil::IOBuf out; ssize_t len = 0; + ssize_t unwritten_data_size = 0; for (size_t i = 0; i < size; ++i) { - StreamFrameMeta fm; - fm.set_stream_id(_remote_settings.stream_id()); - fm.set_source_stream_id(id()); - fm.set_frame_type(FRAME_TYPE_DATA); - // TODO: split large data - fm.set_has_continuation(false); - policy::PackStreamMessage(&out, fm, data_list[i]); - len += data_list[i]->length(); - data_list[i]->clear(); + butil::IOBuf *data = data_list[i]; + size_t length = data->length(); + if(length > FLAGS_stream_write_max_segment_size) { Review Comment: if后面加一个空格,下同 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org