From 9c387c0ebefa29fa859aa0c1d0d85c348905d9db Mon Sep 17 00:00:00 2001 From: HowarLi Date: Wed, 3 Jul 2024 10:55:59 +0000 Subject: [PATCH] fix bug: switch between stream_rpc and baidu_std --- src/brpc/input_messenger.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/brpc/input_messenger.cpp b/src/brpc/input_messenger.cpp index 3f740b1c15..d6e1c35670 100644 --- a/src/brpc/input_messenger.cpp +++ b/src/brpc/input_messenger.cpp @@ -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()