mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 11:42:34 +00:00
hci: check as first the connection identifier, then if there is a free place on Bluetooth module
This commit is contained in:
parent
7555fa8be4
commit
79a2851b6a
16
src/hci.c
16
src/hci.c
@ -965,14 +965,6 @@ uint8_t hci_send_acl_packet_buffer(int size){
|
||||
uint8_t * packet = hci_stack->hci_packet_buffer;
|
||||
hci_con_handle_t con_handle = READ_ACL_CONNECTION_HANDLE(packet);
|
||||
|
||||
// check for free places on Bluetooth module
|
||||
if (!hci_can_send_prepared_acl_packet_now(con_handle)) {
|
||||
log_error("hci_send_acl_packet_buffer called but no free ACL buffers on controller");
|
||||
hci_release_packet_buffer();
|
||||
hci_emit_transport_packet_sent();
|
||||
return BTSTACK_ACL_BUFFERS_FULL;
|
||||
}
|
||||
|
||||
hci_connection_t *connection = hci_connection_for_handle( con_handle);
|
||||
if (!connection) {
|
||||
log_error("hci_send_acl_packet_buffer called but no connection for handle 0x%04x", con_handle);
|
||||
@ -981,6 +973,14 @@ uint8_t hci_send_acl_packet_buffer(int size){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
// check for free places on Bluetooth module
|
||||
if (!hci_can_send_prepared_acl_packet_now(con_handle)) {
|
||||
log_error("hci_send_acl_packet_buffer called but no free ACL buffers on controller");
|
||||
hci_release_packet_buffer();
|
||||
hci_emit_transport_packet_sent();
|
||||
return BTSTACK_ACL_BUFFERS_FULL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CLASSIC
|
||||
hci_connection_timestamp(connection);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user