| 169 | } |
| 170 | |
| 171 | void 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 | |
| 187 | static void AppendError(const NsheadMeta& meta, |
| 188 | Controller* cntl, butil::IOBuf& buf) { |
nothing calls this directly
no test coverage detected