mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-24 21:39:55 +00:00
hfp: decline incoming rfcomm connection if no memory for state
This commit is contained in:
parent
d982552ac9
commit
400b7c04a0
@ -561,7 +561,15 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
||||
// data: event (8), len(8), address(48), channel (8), rfcomm_cid (16)
|
||||
rfcomm_event_incoming_connection_get_bd_addr(packet, event_addr);
|
||||
hfp_connection = provide_hfp_connection_context_for_bd_addr(event_addr);
|
||||
if (!hfp_connection || hfp_connection->state != HFP_IDLE) return;
|
||||
if (!hfp_connection){
|
||||
log_info("hfp: no memory to accept incoming connection - decline");
|
||||
rfcomm_decline_connection(rfcomm_event_incoming_connection_get_rfcomm_cid(packet));
|
||||
return;
|
||||
}
|
||||
if (hfp_connection->state != HFP_IDLE) {
|
||||
log_error("hfp: incoming connection but state != HFP_IDLE");
|
||||
return;
|
||||
}
|
||||
|
||||
hfp_connection->rfcomm_cid = rfcomm_event_incoming_connection_get_rfcomm_cid(packet);
|
||||
hfp_connection->state = HFP_W4_RFCOMM_CONNECTED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user