File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,14 @@ void SendRpcResponse(int64_t correlation_id,
247247 // Send rpc response over stream even if server side failed to create
248248 // stream for some reason.
249249 if (cntl->has_remote_stream ()){
250+ // In certain cases, if the server-side stream is actively closing the stream.
251+ // The client-side cannot receive on_closed message due to connectted is not set.
252+ // We should set connected before send stream data.
253+ if (stream_ptr) {
254+ // Now it's ok the mark this server-side stream as connectted as all the
255+ // written user data would follower the RPC response.
256+ ((Stream*)stream_ptr->conn ())->SetConnected ();
257+ }
250258 // Send the response over stream to notify that this stream connection
251259 // is successfully built.
252260 // Response_stream can be INVALID_STREAM_ID when error occurs.
@@ -262,12 +270,6 @@ void SendRpcResponse(int64_t correlation_id,
262270 }
263271 return ;
264272 }
265-
266- if (stream_ptr) {
267- // Now it's ok the mark this server-side stream as connected as all the
268- // written user data would follower the RPC response.
269- ((Stream*)stream_ptr->conn ())->SetConnected ();
270- }
271273 } else {
272274 // Have the risk of unlimited pending responses, in which case, tell
273275 // users to set max_concurrency.
You can’t perform that action at this time.
0 commit comments