Skip to content

Commit b4b5b90

Browse files
committed
Fix: set connected before send stream data
1 parent df69b95 commit b4b5b90

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/brpc/policy/baidu_rpc_protocol.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ 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+
if (stream_ptr) {
251+
// Now it's ok the mark this server-side stream as connectted as all the
252+
// written user data would follower the RPC response.
253+
((Stream*)stream_ptr->conn())->SetConnected();
254+
}
250255
// Send the response over stream to notify that this stream connection
251256
// is successfully built.
252257
// Response_stream can be INVALID_STREAM_ID when error occurs.
@@ -262,12 +267,6 @@ void SendRpcResponse(int64_t correlation_id,
262267
}
263268
return;
264269
}
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-
}
271270
} else{
272271
// Have the risk of unlimited pending responses, in which case, tell
273272
// users to set max_concurrency.

0 commit comments

Comments
 (0)