Skip to content

GATT fixes (server-only, dynamic-services-only, no-bonds)#126

Open
nebkat wants to merge 3 commits into
espressif:nimble-1.6.0-idffrom
nebkat:release/v6.0.1
Open

GATT fixes (server-only, dynamic-services-only, no-bonds)#126
nebkat wants to merge 3 commits into
espressif:nimble-1.6.0-idffrom
nebkat:release/v6.0.1

Conversation

@nebkat

@nebkat nebkat commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Three small fixes for build/runtime issues that appear when NimBLE is built with non-default configurations (server-only, dynamic-services-only, no bonds).

Commits

  • a656f28 fix(nimble): Allow connections when only using dynamic services
    When only dynamic services are registered, the static ble_gatts_clt_cfg_pool is initialized with zero blocks, so mp_num_free == 0 permanently — ble_gatts_conn_can_alloc() then refuses every connection. Treat mp_num_blocks == 0 as "pool unused" rather than "pool exhausted".

  • 0307d1b fix(nimble): Guard ble_gattc_cache_refresh with BLE_GATTC
    ble_gattc_cache_refresh() calls client-only APIs but sat outside the surrounding #if MYNEWT_VAL(BLE_GATTC) guard, breaking server-only builds. Moves the #endif past the function.

  • 30f3498 fix(nimble): Only allocate ble_gatts_conn_aware_states if MAX_BONDS > 0
    In ble_gatts_start(), the nimble_platform_mem_calloc(1, sizeof(...) * BLE_STORE_MAX_BONDS) call zero-sizes when BLE_STORE_MAX_BONDS == 0, and the subsequent NULL check then fails the start. Skip the allocation entirely when no bonds are configured.

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

nebkat added 3 commits May 8, 2026 19:57
When no non-dynamic services have been added the ble_gatts_clt_cfg_pool is empty.
Because of this, it reports having no free blocks, as if it was full.
We must check if there are any blocks available at all, in case they are all
stored in dynamic services.
@nebkat nebkat mentioned this pull request Jun 16, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant