Skip to content

Commit

Permalink
[fix](thirdparty) patch brpc 1.4.0 to fix stream rpc (#30476)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijchen authored Jan 29, 2024
1 parent b365be3 commit 6d6179a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions thirdparty/patches/brpc-1.4.0-fix-stream-rpc-set-connected.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 9acc6ef89d8770d5516953e2eadf0c27a7d424fc Mon Sep 17 00:00:00 2001
From: Kaijie Chen <[email protected]>
Date: Sun, 28 Jan 2024 15:58:31 +0800
Subject: [PATCH] fix set connected for stream rpc

---
src/brpc/policy/baidu_rpc_protocol.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/brpc/policy/baidu_rpc_protocol.cpp b/src/brpc/policy/baidu_rpc_protocol.cpp
index 0239960e..c47903a6 100644
--- a/src/brpc/policy/baidu_rpc_protocol.cpp
+++ b/src/brpc/policy/baidu_rpc_protocol.cpp
@@ -234,6 +234,11 @@ void SendRpcResponse(int64_t correlation_id,
// Send rpc response over stream even if server side failed to create
// stream for some reasons.
if(cntl->has_remote_stream()){
+ if(stream_ptr) {
+ // Now it's ok the mark this server-side stream as connectted as all the
+ // written user data would follower the RPC response.
+ ((Stream*)stream_ptr->conn())->SetConnected();
+ }
// Send the response over stream to notify that this stream connection
// is successfully built.
// Response_stream can be INVALID_STREAM_ID when error occurs.
@@ -249,12 +254,6 @@ void SendRpcResponse(int64_t correlation_id,
}
return;
}
-
- if(stream_ptr) {
- // Now it's ok the mark this server-side stream as connectted as all the
- // written user data would follower the RPC response.
- ((Stream*)stream_ptr->conn())->SetConnected();
- }
} else{
// Have the risk of unlimited pending responses, in which case, tell
// users to set max_concurrency.
--
2.39.3

0 comments on commit 6d6179a

Please sign in to comment.