|
21 | 21 | #include "trpc/util/hash_util.h" |
22 | 22 | #include "trpc/util/log/logging.h" |
23 | 23 | #include "trpc/util/time.h" |
24 | | -// #ifdef TRPC_BUILD_INCLUDE_RPCZ |
25 | | -// #include "trpc/rpcz/filter/rpcz_filter_index.h" |
26 | | -// #include "trpc/rpcz/span.h" |
27 | | -// #endif |
28 | 24 |
|
29 | 25 | namespace trpc { |
30 | 26 |
|
@@ -75,39 +71,6 @@ void RegisterMakeClientContextCallback(MakeClientContextCallback&& callback) { |
75 | 71 | callbacks.emplace_back(std::move(callback)); |
76 | 72 | } |
77 | 73 |
|
78 | | -ClientContextPtr MakeClientContext(const ServerContextPtr& ctx) { |
79 | | - ClientContextPtr client_ctx = MakeRefCounted<ClientContext>(); |
80 | | - |
81 | | - const auto& trans_info = ctx->GetPbReqTransInfo(); |
82 | | - if (trans_info.size() > 0) { |
83 | | - client_ctx->SetReqTransInfo(trans_info.begin(), trans_info.end()); |
84 | | - } |
85 | | - |
86 | | - client_ctx->SetMessageType(ctx->GetMessageType()); |
87 | | - client_ctx->SetCallerName(ctx->GetCalleeName()); |
88 | | - client_ctx->SetCallerFuncName(ctx->GetFuncName()); |
89 | | - |
90 | | - RunMakeClientContextCallbacks(ctx, client_ctx); |
91 | | - |
92 | | - // Calculate the remaining timeout and set it to the client context. |
93 | | - int64_t nowms = static_cast<int64_t>(trpc::time::GetMilliSeconds()); |
94 | | - int64_t cost_time = nowms - ctx->GetRecvTimestamp(); |
95 | | - int64_t left_time = static_cast<int64_t>(ctx->GetTimeout()) - cost_time; |
96 | | - if (left_time < 0) { |
97 | | - left_time = 0; |
98 | | - } |
99 | | - |
100 | | - client_ctx->SetTimeout(left_time); |
101 | | - |
102 | | - if (ctx->IsUseFullLinkTimeout()) { |
103 | | - client_ctx->SetFullLinkTimeout(left_time); |
104 | | - } else { |
105 | | - client_ctx->SetTimeout(left_time); |
106 | | - } |
107 | | - |
108 | | - return client_ctx; |
109 | | -} |
110 | | - |
111 | 74 | ClientContextPtr MakeClientContext(const ServiceProxyPtr& proxy) { |
112 | 75 | TRPC_ASSERT(proxy && "proxy must be created before create a ClientContext obj"); |
113 | 76 | return MakeRefCounted<ClientContext>(proxy->GetClientCodec()); |
|
0 commit comments