This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b80e952 BugFix: Send WindowUpdate when ClearAbandonedStreams is 
called (#1786)
4b80e952 is described below

commit 4b80e9520130faaa209667a20e08de86da9e92d6
Author: Jiashun Zhu <[email protected]>
AuthorDate: Thu Jun 9 04:57:30 2022 +0200

    BugFix: Send WindowUpdate when ClearAbandonedStreams is called (#1786)
---
 src/brpc/policy/http2_rpc_protocol.cpp | 13 +++----------
 src/brpc/policy/http2_rpc_protocol.h   |  1 -
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/brpc/policy/http2_rpc_protocol.cpp 
b/src/brpc/policy/http2_rpc_protocol.cpp
index ed57bcfe..ab14863c 100644
--- a/src/brpc/policy/http2_rpc_protocol.cpp
+++ b/src/brpc/policy/http2_rpc_protocol.cpp
@@ -372,7 +372,7 @@ int H2Context::Init() {
     return 0;
 }
 
-H2StreamContext* H2Context::RemoveStream(int stream_id) {
+H2StreamContext* H2Context::RemoveStreamAndDeferWU(int stream_id) {
     H2StreamContext* sctx = NULL;
     {
         std::unique_lock<butil::Mutex> mu(_stream_mutex);
@@ -380,17 +380,10 @@ H2StreamContext* H2Context::RemoveStream(int stream_id) {
             return NULL;
         }
     }
-    return sctx;
-}
-
-H2StreamContext* H2Context::RemoveStreamAndDeferWU(int stream_id) {
-    H2StreamContext* sctx = RemoveStream(stream_id);
     // The remote stream will not send any more data, sending back the
     // stream-level WINDOW_UPDATE is pointless, just move the value into
     // the connection.
-    if (sctx) {
-        DeferWindowUpdate(sctx->ReleaseDeferredWindowUpdate());
-    }
+    DeferWindowUpdate(sctx->ReleaseDeferredWindowUpdate());
     return sctx;
 }
 
@@ -1152,7 +1145,7 @@ inline void H2Context::ClearAbandonedStreams() {
         const uint32_t stream_id = _abandoned_streams.back();
         _abandoned_streams.pop_back();
         mu.unlock();
-        H2StreamContext* sctx = RemoveStream(stream_id);
+        H2StreamContext* sctx = RemoveStreamAndDeferWU(stream_id);
         if (sctx != NULL) {
             delete sctx;
         }
diff --git a/src/brpc/policy/http2_rpc_protocol.h 
b/src/brpc/policy/http2_rpc_protocol.h
index 7e2061b4..b4422ee0 100644
--- a/src/brpc/policy/http2_rpc_protocol.h
+++ b/src/brpc/policy/http2_rpc_protocol.h
@@ -371,7 +371,6 @@ friend void InitFrameHandlers();
     H2ParseResult OnContinuation(butil::IOBufBytesIterator&, const 
H2FrameHead&);
 
     H2StreamContext* RemoveStreamAndDeferWU(int stream_id);
-    H2StreamContext* RemoveStream(int stream_id);
     void RemoveGoAwayStreams(int goaway_stream_id, 
std::vector<H2StreamContext*>* out_streams);
 
     H2StreamContext* FindStream(int stream_id);


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

Reply via email to