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

Function SerializeEspRequest

src/brpc/policy/esp_protocol.cpp:65–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void SerializeEspRequest(
66 butil::IOBuf* request_buf,
67 Controller* cntl,
68 const google::protobuf::Message* req_base) {
69
70 if (req_base == NULL) {
71 return cntl->SetFailed(EREQUEST, "request is NULL");
72 }
73 ControllerPrivateAccessor accessor(cntl);
74 if (req_base->GetDescriptor() != EspMessage::descriptor()) {
75 return cntl->SetFailed(EINVAL, "Type of request must be EspMessage");
76 }
77 if (cntl->response() != NULL &&
78 cntl->response()->GetDescriptor() != EspMessage::descriptor()) {
79 return cntl->SetFailed(EINVAL, "Type of response must be EspMessage");
80 }
81 const EspMessage* req = (const EspMessage*)req_base;
82
83 EspHead head = req->head;
84 head.body_len = req->body.size();
85 request_buf->append(&head, sizeof(head));
86 request_buf->append(req->body);
87}
88
89void PackEspRequest(butil::IOBuf* packet_buf,
90 SocketMessage**,

Callers 2

WriteResponseMethod · 0.85
TEST_FFunction · 0.85

Calls 5

responseMethod · 0.80
SetFailedMethod · 0.45
GetDescriptorMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by 2

WriteResponseMethod · 0.68
TEST_FFunction · 0.68