hci: discard ACL fragement on connection close, too

This commit is contained in:
Matthias Ringwald 2016-07-29 10:51:54 +02:00
parent 28a0332dbe
commit c6a37cfdba

View File

@ -1717,9 +1717,17 @@ static void event_handler(uint8_t *packet, int size){
case HCI_EVENT_DISCONNECTION_COMPLETE:
if (packet[2]) break; // status != 0
handle = little_endian_read_16(packet, 3);
conn = hci_connection_for_handle(handle);
if (!conn) break; // no conn struct anymore
// drop outgoing ACL fragments if it is for closed connection
if (hci_stack->acl_fragmentation_total_size > 0) {
if (handle == READ_ACL_CONNECTION_HANDLE(hci_stack->hci_packet_buffer)){
log_info("hci: drop fragmented ACL data for closed connection");
hci_stack->acl_fragmentation_total_size = 0;
hci_stack->acl_fragmentation_pos = 0;
}
}
// re-enable advertisements for le connections if active
conn = hci_connection_for_handle(handle);
if (!conn) break;
if (hci_is_le_connection(conn) && hci_stack->le_advertisements_enabled){
hci_stack->le_advertisements_todo |= LE_ADVERTISEMENT_TASKS_ENABLE;
}