use MessageBuilder::toBytes (#2167)

old-commit-hash: 272f60221c45cc543660a5e491cb800182c8b8f2
This commit is contained in:
Dean Lee
2020-09-14 16:17:00 +08:00
committed by GitHub
parent 218c3d3de7
commit ef811e1105
+3 -6
View File
@@ -312,8 +312,7 @@ void encoder_thread(bool is_streaming, bool raw_clips, int cam_idx) {
eidx.setSegmentNum(out_segment);
eidx.setSegmentId(out_id);
auto words = capnp::messageToFlatArray(msg);
auto bytes = words.asBytes();
auto bytes = msg.toBytes();
if (idx_sock->send((char*)bytes.begin(), bytes.size()) < 0) {
printf("err sending encodeIdx pkt: %s\n", strerror(errno));
@@ -343,8 +342,7 @@ void encoder_thread(bool is_streaming, bool raw_clips, int cam_idx) {
eidx.setSegmentNum(out_segment);
eidx.setSegmentId(out_id);
auto words = capnp::messageToFlatArray(msg);
auto bytes = words.asBytes();
auto bytes = msg.toBytes();
if (lh) {
lh_log(lh, bytes.begin(), bytes.size(), false);
}
@@ -518,8 +516,7 @@ static void bootlog() {
std::string lastPmsg = util::read_file("/sys/fs/pstore/pmsg-ramoops-0");
boot.setLastPmsg(capnp::Data::Reader((const kj::byte*)lastPmsg.data(), lastPmsg.size()));
auto words = capnp::messageToFlatArray(msg);
auto bytes = words.asBytes();
auto bytes = msg.toBytes();
logger_log(&s.logger, bytes.begin(), bytes.size(), false);
}