|
| 1 | +From 9acc6ef89d8770d5516953e2eadf0c27a7d424fc Mon Sep 17 00:00:00 2001 |
| 2 | +From: Kaijie Chen <ckj@apache.org> |
| 3 | +Date: Sun, 28 Jan 2024 15:58:31 +0800 |
| 4 | +Subject: [PATCH] fix set connected for stream rpc |
| 5 | + |
| 6 | +--- |
| 7 | + src/brpc/policy/baidu_rpc_protocol.cpp | 11 +++++------ |
| 8 | + 1 file changed, 5 insertions(+), 6 deletions(-) |
| 9 | + |
| 10 | +diff --git a/src/brpc/policy/baidu_rpc_protocol.cpp b/src/brpc/policy/baidu_rpc_protocol.cpp |
| 11 | +index 0239960e..c47903a6 100644 |
| 12 | +--- a/src/brpc/policy/baidu_rpc_protocol.cpp |
| 13 | ++++ b/src/brpc/policy/baidu_rpc_protocol.cpp |
| 14 | +@@ -234,6 +234,11 @@ void SendRpcResponse(int64_t correlation_id, |
| 15 | + // Send rpc response over stream even if server side failed to create |
| 16 | + // stream for some reasons. |
| 17 | + if(cntl->has_remote_stream()){ |
| 18 | ++ if(stream_ptr) { |
| 19 | ++ // Now it's ok the mark this server-side stream as connectted as all the |
| 20 | ++ // written user data would follower the RPC response. |
| 21 | ++ ((Stream*)stream_ptr->conn())->SetConnected(); |
| 22 | ++ } |
| 23 | + // Send the response over stream to notify that this stream connection |
| 24 | + // is successfully built. |
| 25 | + // Response_stream can be INVALID_STREAM_ID when error occurs. |
| 26 | +@@ -249,12 +254,6 @@ void SendRpcResponse(int64_t correlation_id, |
| 27 | + } |
| 28 | + return; |
| 29 | + } |
| 30 | +- |
| 31 | +- if(stream_ptr) { |
| 32 | +- // Now it's ok the mark this server-side stream as connectted as all the |
| 33 | +- // written user data would follower the RPC response. |
| 34 | +- ((Stream*)stream_ptr->conn())->SetConnected(); |
| 35 | +- } |
| 36 | + } else{ |
| 37 | + // Have the risk of unlimited pending responses, in which case, tell |
| 38 | + // users to set max_concurrency. |
| 39 | +-- |
| 40 | +2.39.3 |
| 41 | + |
0 commit comments