fix code to set connectio state to RECEIVED_DISCONNECTION_COMPLETE

This commit is contained in:
matthias.ringwald@gmail.com 2015-02-10 18:39:00 +00:00
parent a0c35809ae
commit a4f30ec095

View File

@ -1252,16 +1252,13 @@ static void event_handler(uint8_t *packet, int size){
// HCI_EVENT_DISCONNECTION_COMPLETE // HCI_EVENT_DISCONNECTION_COMPLETE
// has been split, to first notify stack before shutting connection down // has been split, to first notify stack before shutting connection down
// see end of function, too. // see end of function, too.
if (packet[0] == HCI_EVENT_DISCONNECTION_COMPLETE){ case HCI_EVENT_DISCONNECTION_COMPLETE:
if (!packet[2]){ if (packet[2]) break; // status != 0
handle = READ_BT_16(packet, 3); handle = READ_BT_16(packet, 3);
hci_connection_t * conn = hci_connection_for_handle(handle); hci_connection_t * conn = hci_connection_for_handle(handle);
if (conn) { if (!conn) break; // no conn struct anymore
conn->state = RECEIVED_DISCONNECTION_COMPLETE; conn->state = RECEIVED_DISCONNECTION_COMPLETE;
}
}
break; break;
}
case HCI_EVENT_HARDWARE_ERROR: case HCI_EVENT_HARDWARE_ERROR:
if(hci_stack->control && hci_stack->control->hw_error){ if(hci_stack->control && hci_stack->control->hw_error){