Merge pull request #6800 from dhalbert/PacketBuffer-ringbuf-size

PacketBuffer ringbuf size
This commit is contained in:
Dan Halbert 2022-08-25 08:35:44 -04:00 committed by GitHub
commit 59af865b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,7 +300,8 @@ void common_hal_bleio_packet_buffer_construct(
size_t incoming_buffer_size = 0;
uint32_t *incoming_buffer = NULL;
if (incoming) {
incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size);
// + 1 needed by ringbuf for empty/full detection.
incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size) + 1;
incoming_buffer = m_malloc(incoming_buffer_size, false);
}