Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96f6f128 authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Fix HCI parsing bottleneck

Current implementation limited the number of HCI packets
parsed to one every 3 ticks. This change modifies the HCI
transport to continue reading from the data channel as long
as information is available.

Test: m root-canal
Bug: 271869468
Change-Id: Ibbfbd7a3fb3c4ca4d085bce9e03b4c8f2df3968d
parent 7bfd79ae
Loading
Loading
Loading
Loading
+26 −20
Original line number Diff line number Diff line
@@ -66,6 +66,11 @@ size_t H4DataChannelPacketizer::Send(uint8_t type, const uint8_t* data,

void H4DataChannelPacketizer::OnDataReady(
   std::shared_ptr<AsyncDataChannel> socket) {

  // Continue reading from the async data channel as long as bytes
  // are available to read. Otherwise this limits the number of HCI
  // packets parsed to one every 3 ticks.
  for (;;) {
    ssize_t bytes_to_read = h4_parser_.BytesRequested();
    std::vector<uint8_t> buffer(bytes_to_read);

@@ -92,5 +97,6 @@ void H4DataChannelPacketizer::OnDataReady(
    }
    h4_parser_.Consume(buffer.data(), bytes_read);
  }
}

}  // namespace rootcanal