mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-01 00:28:18 +00:00
gap: return command disallowed if disconnect already requested
This commit is contained in:
parent
66093044db
commit
61972f0a59
@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- HID Host: return complete HID report
|
||||
|
||||
### Changed
|
||||
- GAP: return command disallowed if disconnect already requested
|
||||
|
||||
|
||||
## Release v1.6.1
|
||||
|
||||
|
22
src/hci.c
22
src/hci.c
@ -9035,13 +9035,23 @@ uint8_t gap_disconnect(hci_con_handle_t handle){
|
||||
hci_emit_disconnection_complete(handle, 0);
|
||||
return 0;
|
||||
}
|
||||
// ignore if already disconnected
|
||||
if (conn->state == RECEIVED_DISCONNECTION_COMPLETE){
|
||||
return 0;
|
||||
uint8_t status = ERROR_CODE_SUCCESS;
|
||||
switch (conn->state){
|
||||
case RECEIVED_DISCONNECTION_COMPLETE:
|
||||
// ignore if remote just disconnected
|
||||
break;
|
||||
case SEND_DISCONNECT:
|
||||
case SENT_DISCONNECT:
|
||||
// disconnect already requested or sent
|
||||
status = ERROR_CODE_COMMAND_DISALLOWED;
|
||||
break;
|
||||
default:
|
||||
// trigger hci_disconnect
|
||||
conn->state = SEND_DISCONNECT;
|
||||
hci_run();
|
||||
break;
|
||||
}
|
||||
conn->state = SEND_DISCONNECT;
|
||||
hci_run();
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
int gap_read_rssi(hci_con_handle_t con_handle){
|
||||
|
Loading…
Reference in New Issue
Block a user