fix(ble): fiexed the crash issue of examples/bluetooth/nimble/ble_multi_conn

This commit is contained in:
Shen Weilong 2024-09-12 20:36:39 +08:00
parent 1889851d7c
commit 798b7c92c4

View File

@ -194,9 +194,9 @@ ble_prph_gap_event(struct ble_gap_event *event, void *arg)
/* A new connection was established. */ /* A new connection was established. */
ESP_LOGI(TAG, "Connection established. Handle:%d. Total:%d", event->connect.conn_handle, ESP_LOGI(TAG, "Connection established. Handle:%d. Total:%d", event->connect.conn_handle,
++s_ble_prph_conn_num); ++s_ble_prph_conn_num);
#if !CONFIG_EXAMPLE_EXTENDED_ADV && CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED #if CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED
ble_prph_restart_adv(); ble_prph_restart_adv();
#endif // !CONFIG_EXAMPLE_EXTENDED_ADV && CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED #endif //CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED
} else { } else {
/* Restart the advertising */ /* Restart the advertising */
ble_prph_restart_adv(); ble_prph_restart_adv();
@ -214,9 +214,6 @@ ble_prph_gap_event(struct ble_gap_event *event, void *arg)
#if CONFIG_EXAMPLE_EXTENDED_ADV #if CONFIG_EXAMPLE_EXTENDED_ADV
case BLE_GAP_EVENT_ADV_COMPLETE: case BLE_GAP_EVENT_ADV_COMPLETE:
ESP_LOGI(TAG, "advertisement completed. Reason=%d.",event->adv_complete.reason); ESP_LOGI(TAG, "advertisement completed. Reason=%d.",event->adv_complete.reason);
#if CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED
ble_prph_restart_adv();
#endif // CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED
return 0; return 0;
#endif // CONFIG_EXAMPLE_EXTENDED_ADV #endif // CONFIG_EXAMPLE_EXTENDED_ADV