att_server: check handle in disconnection complete event

This commit is contained in:
Matthias Ringwald 2016-07-29 11:33:28 +02:00
parent c6a37cfdba
commit 70a390c7e0

View File

@ -174,11 +174,11 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
break;
case HCI_EVENT_DISCONNECTION_COMPLETE:
// check handle
if (att_connection.con_handle != hci_event_disconnection_complete_get_connection_handle(packet)) break;
att_clear_transaction_queue(&att_connection);
att_connection.con_handle = 0;
att_handle_value_indication_handle = 0; // reset error state
// restart advertising if we have been connected before
// -> avoid sending advertise enable a second time before command complete was received
att_server_state = ATT_SERVER_IDLE;
break;