mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-22 11:00:47 +01:00
Fix crash that could occur when server reconnects
* Update to not change services if they have not actually changed when starting the server Closes #270
This commit is contained in:
parent
0d13044703
commit
e843c6811c
1 changed files with 7 additions and 0 deletions
|
@ -91,6 +91,13 @@ void NimBLEService::dump() const {
|
||||||
*/
|
*/
|
||||||
bool NimBLEService::start() {
|
bool NimBLEService::start() {
|
||||||
NIMBLE_LOGD(LOG_TAG, ">> start(): Starting service: %s", toString().c_str());
|
NIMBLE_LOGD(LOG_TAG, ">> start(): Starting service: %s", toString().c_str());
|
||||||
|
|
||||||
|
// If started previously and no characteristics have been added or removed,
|
||||||
|
// then we can skip the service registration process.
|
||||||
|
if (m_pSvcDef->characteristics && !getServer()->m_svcChanged) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// If started previously, clear everything and start over
|
// If started previously, clear everything and start over
|
||||||
if (m_pSvcDef->characteristics) {
|
if (m_pSvcDef->characteristics) {
|
||||||
if (m_pSvcDef->characteristics->descriptors) {
|
if (m_pSvcDef->characteristics->descriptors) {
|
||||||
|
|
Loading…
Reference in a new issue