mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-25 09:35:42 +00:00
l2cap-ertm: assert that packet can be stored in fragment buffers in ertm
This commit is contained in:
parent
b5858f2df2
commit
2e4c1850fc
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- L2CAP ERTM: assert that packet can be stored in fragment buffers in ertm
|
||||
|
||||
### Added
|
||||
- GAP: allow to reject GAP classic connection via gap_register_classic_connection_filter
|
||||
|
12
src/l2cap.c
12
src/l2cap.c
@ -2700,6 +2700,18 @@ static void l2cap_signaling_handler_channel(l2cap_channel_t *channel, uint8_t *c
|
||||
break;
|
||||
}
|
||||
if (l2cap_channel_ready_for_open(channel)){
|
||||
|
||||
#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
|
||||
// assert that packet can be stored in fragment buffers in ertm
|
||||
if (channel->mode == L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION){
|
||||
uint16_t effective_mps = btstack_min(channel->remote_mps, channel->local_mps);
|
||||
uint16_t usable_mtu = channel->num_tx_buffers == 1 ? effective_mps : channel->num_tx_buffers * effective_mps - 2;
|
||||
if (usable_mtu < channel->remote_mtu){
|
||||
log_info("Remote MTU %u > max storable ERTM packet, only using MTU = %u", channel->remote_mtu, usable_mtu);
|
||||
channel->remote_mtu = usable_mtu;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// for open:
|
||||
channel->state = L2CAP_STATE_OPEN;
|
||||
l2cap_emit_channel_opened(channel, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user