You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/10/20 09:20:15 UTC

[GitHub] [incubator-brpc] chenbay commented on a diff in pull request #1958: limiting max bytes in stream comsume queue with the same host socket

chenbay commented on code in PR #1958:
URL: https://github.com/apache/incubator-brpc/pull/1958#discussion_r1000376389


##########
src/brpc/stream.cpp:
##########
@@ -284,21 +291,43 @@ int Stream::AppendIfNotFull(const butil::IOBuf &data) {
         _produced -= data.length();
         return -1;
     }
+    if (FLAGS_socket_max_streams_unconsumed_bytes > 0) {
+        _host_socket->_total_streams_unconsumed_size += data.length();
+    }
     return 0;
 }
 
 void Stream::SetRemoteConsumed(size_t new_remote_consumed) {
-    CHECK(_options.max_buf_size > 0);
+    CHECK(_cur_max_buf_size > 0);
     bthread_id_list_t tmplist;
     bthread_id_list_init(&tmplist, 0, 0);
     bthread_mutex_lock(&_congestion_control_mutex);
     if (_remote_consumed >= new_remote_consumed) {
         bthread_mutex_unlock(&_congestion_control_mutex);
         return;
     }
-    const bool was_full = _produced >= _remote_consumed + (size_t)_options.max_buf_size;
+    const bool was_full = _produced >= _remote_consumed + (size_t)_cur_max_buf_size;
+
+    if (FLAGS_socket_max_streams_unconsumed_bytes > 0) {
+        _host_socket->_total_streams_unconsumed_size -= new_remote_consumed - _remote_consumed;
+        if (_host_socket->_total_streams_unconsumed_size <= FLAGS_socket_max_streams_unconsumed_bytes) {

Review Comment:
   是的,= =



-- 
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-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org