Skip to content

Commit

Permalink
Merge pull request #2678 from howarle/fix_stream_rpc
Browse files Browse the repository at this point in the history
fix bug: switch between stream_rpc and baidu_std
  • Loading branch information
Huixxi authored Jul 7, 2024
2 parents 81ae605 + 9c387c0 commit fdc60ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/brpc/input_messenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,14 @@ ParseResult InputMessenger::CutInputMessage(
}

if (m->CreatedByConnect()) {
if((ProtocolType)cur_index == PROTOCOL_BAIDU_STD) {
if((ProtocolType)cur_index == PROTOCOL_BAIDU_STD && cur_index == preferred) {
// baidu_std may fall to streaming_rpc.
cur_index = (int)PROTOCOL_STREAMING_RPC;
continue;
} else if((ProtocolType)cur_index == PROTOCOL_STREAMING_RPC && cur_index == preferred) {
// streaming_rpc may fall to baidu_std.
cur_index = (int)PROTOCOL_BAIDU_STD;
continue;
} else {
// The protocol is fixed at client-side, no need to try others.
LOG(ERROR) << "Fail to parse response from " << m->remote_side()
Expand Down

0 comments on commit fdc60ba

Please sign in to comment.