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

Method ParseRequestFromIOBuf

src/brpc/policy/ubrpc2pb_protocol.cpp:171–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void UbrpcAdaptor::ParseRequestFromIOBuf(
172 const NsheadMeta&, const NsheadMessage& raw_req,
173 Controller* cntl, google::protobuf::Message* pb_req) const {
174 const std::string msg_name = butil::EnsureString(pb_req->GetDescriptor()->full_name());
175 mcpack2pb::MessageHandler handler = mcpack2pb::find_message_handler(msg_name);
176 if (handler.parse_body == NULL) {
177 return cntl->SetFailed(EREQUEST, "Fail to find parser of %s",
178 msg_name.c_str());
179 }
180 butil::IOBufAsZeroCopyInputStream bodystream(raw_req.body);
181 if (!handler.parse_body(pb_req, &bodystream, raw_req.body.size())) {
182 cntl->SetFailed(EREQUEST, "Fail to parse %s", msg_name.c_str());
183 return;
184 }
185}
186
187static void AppendError(const NsheadMeta& meta,
188 Controller* cntl, butil::IOBuf& buf) {

Callers

nothing calls this directly

Calls 6

EnsureStringFunction · 0.85
find_message_handlerFunction · 0.85
GetDescriptorMethod · 0.45
SetFailedMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected