| 1013 | } |
| 1014 | |
| 1015 | void SerializeRpcRequest(butil::IOBuf* request_buf, Controller* cntl, |
| 1016 | const google::protobuf::Message* request) { |
| 1017 | // Check sanity of request. |
| 1018 | if (NULL == request) { |
| 1019 | return cntl->SetFailed(EREQUEST, "`request' is NULL"); |
| 1020 | } |
| 1021 | if (request->GetDescriptor() == SerializedRequest::descriptor()) { |
| 1022 | request_buf->append(((SerializedRequest*)request)->serialized_data()); |
| 1023 | return; |
| 1024 | } |
| 1025 | if (!request->IsInitialized()) { |
| 1026 | return cntl->SetFailed(EREQUEST, "Missing required fields in request: %s", |
| 1027 | request->InitializationErrorString().c_str()); |
| 1028 | } |
| 1029 | |
| 1030 | ContentType content_type = cntl->request_content_type(); |
| 1031 | CompressType compress_type = cntl->request_compress_type(); |
| 1032 | ChecksumType checksum_type = cntl->request_checksum_type(); |
| 1033 | if (!SerializeRpcMessage(*request, *cntl, content_type, compress_type, |
| 1034 | checksum_type, request_buf)) { |
| 1035 | return cntl->SetFailed( |
| 1036 | EREQUEST, |
| 1037 | "Fail to compress request=%s, " |
| 1038 | "ContentType=%s, CompressType=%s, ChecksumType=%s", |
| 1039 | butil::EnsureString(request->GetDescriptor()->full_name()).c_str(), |
| 1040 | ContentTypeToCStr(content_type), CompressTypeToCStr(compress_type), |
| 1041 | ChecksumTypeToCStr(checksum_type)); |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | void PackRpcRequest(butil::IOBuf* req_buf, |
| 1046 | SocketMessage**, |
nothing calls this directly
no test coverage detected