guard against repeated calls to ble_initializeSecurity()

This commit is contained in:
Rohit Grover 2015-04-27 08:58:14 +01:00
parent 002f61cf83
commit 989c629008

View file

@ -26,6 +26,12 @@ static ret_code_t dm_handler(dm_handle_t const *p_handle, dm_event_t const *p_ev
ble_error_t
btle_initializeSecurity()
{
/* guard against multiple initializations */
static bool initialized = false;
if (initialized) {
return BLE_ERROR_NONE;
}
if (pstorage_init() != NRF_SUCCESS) {
return BLE_ERROR_UNSPECIFIED;
}
@ -67,6 +73,7 @@ btle_initializeSecurity()
}
}
initialized = true;
return BLE_ERROR_NONE;
}