From b5d8b22b3c5e26a60d99f971753b6690703795bf Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Tue, 18 Nov 2014 14:48:29 +0000 Subject: [PATCH] send remaining acl fragemnts first as they block the outgoing packet buffer --- src/hci.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/hci.c b/src/hci.c index 476026453..f09cf3934 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1783,7 +1783,22 @@ void hci_run(){ hci_connection_t * connection; linked_item_t * it; - + + // send continuation fragments first, as they block the prepared packet buffer + if (hci_stack->acl_fragmentation_total_size > 0) { + hci_con_handle_t con_handle = READ_ACL_CONNECTION_HANDLE(hci_stack->hci_packet_buffer); + if (hci_can_send_prepared_acl_packet_now(con_handle)){ + hci_connection_t *connection = hci_connection_for_handle(con_handle); + if (connection) { + hci_send_acl_packet_fragments(connection); + return; + } + // connection gone -> discard further fragments + hci_stack->acl_fragmentation_total_size = 0; + hci_stack->acl_fragmentation_pos = 0; + } + } + if (!hci_can_send_command_packet_now()) return; // global/non-connection oriented commands @@ -1980,21 +1995,6 @@ void hci_run(){ #endif } - // send continuation fragments - if (hci_stack->acl_fragmentation_total_size > 0) { - hci_con_handle_t con_handle = READ_ACL_CONNECTION_HANDLE(hci_stack->hci_packet_buffer); - if (hci_can_send_prepared_acl_packet_now(con_handle)){ - hci_connection_t *connection = hci_connection_for_handle(con_handle); - if (connection) { - hci_send_acl_packet_fragments(connection); - return; - } - // connection gone -> discard further fragments - hci_stack->acl_fragmentation_total_size = 0; - hci_stack->acl_fragmentation_pos = 0; - } - } - switch (hci_stack->state){ case HCI_STATE_INITIALIZING: hci_initializing_state_machine();