| 87 | } |
| 88 | |
| 89 | void 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 | |
| 118 | void ProcessEspResponse(InputMessageBase* msg_base) { |
| 119 | const int64_t start_parse_us = butil::cpuwide_time_us(); |