keep baseband connection during authentication

This commit is contained in:
matthias.ringwald 2010-08-26 20:26:48 +00:00
parent 7fde4af91d
commit 80ca58a00d
3 changed files with 13 additions and 1 deletions

View File

@ -128,7 +128,7 @@ static hci_connection_t * connection_for_address(bd_addr_t address){
}
/**
* add authentication flags
* add authentication flags and reset timer
*/
static void hci_add_connection_flags_for_flipped_bd_addr(uint8_t *bd_addr, hci_authentication_flags_t flags){
bd_addr_t addr;
@ -136,9 +136,19 @@ static void hci_add_connection_flags_for_flipped_bd_addr(uint8_t *bd_addr, hci_a
hci_connection_t * conn = connection_for_address(addr);
if (conn) {
conn->authentication_flags |= flags;
hci_connection_timestamp(conn);
}
}
int hci_authentication_active_for_handle(hci_con_handle_t handle){
hci_connection_t * conn = connection_for_handle(handle);
if (!conn) return 0;
if (!conn->authentication_flags) return 0;
if (conn->authentication_flags & SENT_LINK_KEY_REPLY) return 0;
if (conn->authentication_flags & RECV_LINK_KEY_NOTIFICATION) return 0;
return 1;
}
/**
* count connections

View File

@ -243,6 +243,7 @@ hci_connection_t * connection_for_handle(hci_con_handle_t con_handle);
uint8_t hci_number_outgoing_packets(hci_con_handle_t handle);
uint8_t hci_number_free_acl_slots();
int hci_ready_to_send(hci_con_handle_t handle);
int hci_authentication_active_for_handle(hci_con_handle_t handle);
//
void hci_emit_state();

View File

@ -395,6 +395,7 @@ void l2cap_event_handler( uint8_t *packet, uint16_t size ){
// HCI Connection Timeouts
case L2CAP_EVENT_TIMEOUT_CHECK:
handle = READ_BT_16(packet, 2);
if (hci_authentication_active_for_handle(handle)) break;
l2cap_channel_t * channel;
int used = 0;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){