mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-15 13:21:04 +00:00
if l2cap connection fails, drop channel immediately. if connection fails due to security block, drop link key, too
This commit is contained in:
parent
c12e46e766
commit
eb920dbead
12
src/l2cap.c
12
src/l2cap.c
@ -555,8 +555,20 @@ void l2cap_signaling_handler_channel(l2cap_channel_t *channel, uint8_t *command)
|
||||
// connection pending. get some coffee
|
||||
break;
|
||||
default:
|
||||
// channel closed
|
||||
channel->state = L2CAP_STATE_CLOSED;
|
||||
|
||||
// map l2cap connection response result to BTstack status enumeration
|
||||
l2cap_emit_channel_opened(channel, L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL + result);
|
||||
|
||||
// drop link key if security block
|
||||
if (L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL + result == L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY){
|
||||
hci_drop_link_key_for_bd_addr(&channel->address);
|
||||
}
|
||||
|
||||
// discard channel
|
||||
linked_list_remove(&l2cap_channels, (linked_item_t *) channel);
|
||||
free (channel);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user