Open
Description
-
bool FiberTcpConnComplexConnector::MessageHandleFunction(const ConnectionPtr& conn, std::dequestd::any& rsp_list) {
-
bool conn_reusable = true;
-
for (auto&& rsp_buf : rsp_list) {
-
ProtocolPtr rsp_protocol;
-
bool ret = options_.trans_info->rsp_decode_function(std::move(rsp_buf), rsp_protocol);
-
if (TRPC_LIKELY(ret)) {
-
TRPC_ASSERT(rsp_protocol);
-
conn_reusable &= rsp_protocol->IsConnectionReusable();
-
uint32_t id = 0;
-
rsp_protocol->GetRequestId(id);
-
auto ctx = call_map_->TryReclaimContext(id); **// redis协议如何恢复这个上下文 貌似reqid再redis协议中没有透传逻辑**
-
if (TRPC_UNLIKELY(ctx.Get() == nullptr)) {
-
// The request corresponding to the response cannot be found,
-
// and the request may have timed out, so it will not be processed
-
TRPC_LOG_WARN("can not find request, request_id: " << id << ", maybe timeout");
-
continue;
-
-
}
-
-
if (ctx->backup_request_retry_info == nullptr) {
-
ctx->rsp_msg->msg = std::move(rsp_protocol);
-
-
DispatchResponse(std::move(ctx));
-
} else {
-
if (!ctx->backup_request_retry_info->retry->IsReplyReady()) {
-
ctx->rsp_msg->msg = std::move(rsp_protocol);
-
-
DispatchResponse(std::move(ctx));
-
} else {
-
TRPC_LOG_WARN("Get response late when retry, if too many this log, consider a bigger retry delay");
-
DispatchException(std::move(ctx), TrpcRetCode::TRPC_INVOKE_UNKNOWN_ERR, "");
-
}
-
}
-
} else {
-
conn_reusable = false;
-
break;
-
}
-
}
-
return conn_reusable;
-
}
如以上代码11行的疑问 麻烦解答下 谢谢
Metadata
Metadata
Assignees
Labels
No labels