MCPcopy Create free account
hub / github.com/apache/brpc / PackEspRequest

Function PackEspRequest

src/brpc/policy/esp_protocol.cpp:89–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void PackEspRequest(butil::IOBuf* packet_buf,
90 SocketMessage**,
91 uint64_t correlation_id,
92 const google::protobuf::MethodDescriptor*,
93 Controller* cntl,
94 const butil::IOBuf& request,
95 const Authenticator* auth) {
96
97 ControllerPrivateAccessor accessor(cntl);
98 if (cntl->connection_type() == CONNECTION_TYPE_SINGLE) {
99 return cntl->SetFailed(
100 EINVAL, "esp protocol can't work with CONNECTION_TYPE_SINGLE");
101 }
102
103 accessor.get_sending_socket()->set_correlation_id(correlation_id);
104 if (auto span = accessor.span()) {
105 span->set_request_size(request.length());
106 }
107
108 if (auth != NULL) {
109 std::string auth_str;
110 auth->GenerateCredential(&auth_str);
111 //means first request in this connect, need to special head
112 packet_buf->append(auth_str);
113 }
114
115 packet_buf->append(request);
116}
117
118void ProcessEspResponse(InputMessageBase* msg_base) {
119 const int64_t start_parse_us = butil::cpuwide_time_us();

Callers 2

WriteResponseMethod · 0.85
TEST_FFunction · 0.85

Calls 9

connection_typeMethod · 0.80
set_correlation_idMethod · 0.80
get_sending_socketMethod · 0.80
spanMethod · 0.80
set_request_sizeMethod · 0.80
SetFailedMethod · 0.45
lengthMethod · 0.45
GenerateCredentialMethod · 0.45
appendMethod · 0.45

Tested by 2

WriteResponseMethod · 0.68
TEST_FFunction · 0.68