Fix writing the pbstream via gRPC. (#973)

master
Alexander Belyaev 2018-03-09 16:26:03 +01:00 committed by GitHub
parent daa35d3bc8
commit 2fe1867221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 2 deletions

View File

@ -100,7 +100,6 @@ void MapBuilderStub::SerializeState(io::ProtoStreamWriterInterface* writer) {
CHECK(client.Write(request)); CHECK(client.Write(request));
proto::WriteStateResponse response; proto::WriteStateResponse response;
while (client.Read(&response)) { while (client.Read(&response)) {
// writer->WriteProto(response);
switch (response.state_chunk_case()) { switch (response.state_chunk_case()) {
case proto::WriteStateResponse::kPoseGraph: case proto::WriteStateResponse::kPoseGraph:
writer->WriteProto(response.pose_graph()); writer->WriteProto(response.pose_graph());
@ -115,7 +114,6 @@ void MapBuilderStub::SerializeState(io::ProtoStreamWriterInterface* writer) {
LOG(FATAL) << "Unhandled message type"; LOG(FATAL) << "Unhandled message type";
} }
} }
CHECK(writer->Close());
} }
void MapBuilderStub::LoadState(io::ProtoStreamReaderInterface* reader, void MapBuilderStub::LoadState(io::ProtoStreamReaderInterface* reader,

View File

@ -52,6 +52,7 @@ void WriteStateHandler::OnRequest(const google::protobuf::Empty& request) {
}); });
GetContext<MapBuilderContextInterface>()->map_builder().SerializeState( GetContext<MapBuilderContextInterface>()->map_builder().SerializeState(
&proto_stream_writer); &proto_stream_writer);
proto_stream_writer.Close();
} }
} // namespace handlers } // namespace handlers