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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to