mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
hci: handle connection collision, ignore page timeout after incoming connection event
This commit is contained in:
parent
0ca3fe1c31
commit
be7469f189
13
src/hci.c
13
src/hci.c
@ -3859,15 +3859,20 @@ static void event_handler(uint8_t *packet, uint16_t size){
|
||||
if (conn) {
|
||||
switch (conn->state){
|
||||
// expected states
|
||||
case ACCEPTED_CONNECTION_REQUEST:
|
||||
case SENT_CREATE_CONNECTION:
|
||||
break;
|
||||
// unexpected state -> ignore
|
||||
// Page Timeout after incoming connection indicates connection collision => ignore event
|
||||
case RECEIVED_CONNECTION_REQUEST:
|
||||
case ACCEPTED_CONNECTION_REQUEST:
|
||||
if (hci_event_connection_complete_get_status(packet) == ERROR_CODE_PAGE_TIMEOUT) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
// unexpected state -> ignore and don't forward event to app
|
||||
default:
|
||||
// don't forward event to app
|
||||
return;
|
||||
}
|
||||
if (!packet[2]){
|
||||
if (hci_event_connection_complete_get_status(packet) == ERROR_CODE_SUCCESS){
|
||||
conn->state = OPEN;
|
||||
conn->con_handle = little_endian_read_16(packet, 3);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user