send remaining acl fragemnts first as they block the outgoing packet buffer

This commit is contained in:
matthias.ringwald@gmail.com 2014-11-18 14:48:29 +00:00
parent d051460cdf
commit b5d8b22b3c

View File

@ -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();