mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: Change the fragement method to avoid crash when the data transmit should fragement.
This commit is contained in:
parent
2aadbee43c
commit
81ff34742b
@ -26,7 +26,7 @@
|
||||
|
||||
#include "hash_map.h"
|
||||
#include "hash_functions.h"
|
||||
|
||||
#include "bt_trace.h"
|
||||
|
||||
|
||||
#define APPLY_CONTINUATION_FLAG(handle) (((handle) & 0xCFFF) | 0x1000)
|
||||
@ -91,12 +91,11 @@ static void fragment_and_dispatch(BT_HDR *packet)
|
||||
|
||||
max_packet_size = max_data_size + HCI_ACL_PREAMBLE_SIZE;
|
||||
remaining_length = packet->len;
|
||||
|
||||
STREAM_TO_UINT16(continuation_handle, stream);
|
||||
continuation_handle = APPLY_CONTINUATION_FLAG(continuation_handle);
|
||||
if (remaining_length > max_packet_size) {
|
||||
if (remaining_length > max_data_size) {
|
||||
current_fragment_packet = packet;
|
||||
UINT16_TO_STREAM(stream, max_packet_size);
|
||||
UINT16_TO_STREAM(stream, max_data_size);
|
||||
packet->len = max_packet_size;
|
||||
callbacks->fragmented(packet, false);
|
||||
packet->offset += max_data_size;
|
||||
@ -107,7 +106,6 @@ static void fragment_and_dispatch(BT_HDR *packet)
|
||||
stream = packet->data + packet->offset;
|
||||
UINT16_TO_STREAM(stream, continuation_handle);
|
||||
UINT16_TO_STREAM(stream, remaining_length - HCI_ACL_PREAMBLE_SIZE);
|
||||
|
||||
// Apparently L2CAP can set layer_specific to a max number of segments to transmit
|
||||
if (packet->layer_specific) {
|
||||
packet->layer_specific--;
|
||||
|
@ -54,7 +54,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
}
|
||||
|
||||
#ifdef BTTRC_DUMP_BUFFER
|
||||
#define BTTRC_DUMP_BUFFER(_prefix, _data, _len) trc_dump_buffer(_data, _len)
|
||||
#define BTTRC_DUMP_BUFFER(_prefix, _data, _len) trc_dump_buffer(_prefix, _data, _len)
|
||||
#else
|
||||
#define BTTRC_DUMP_BUFFER(_prefix, _data, _len)
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user