mynewt-nimble
mynewt-nimble copied to clipboard
L2CAP COC: Removing a server
(Disclaimer: I'm using the esp-nimble fork, but that should be irrelevant in this context)
Usage case: In my application, I have various subsystems (BLE/L2CAP, WiFi, Ethernet) which all provide access points to a central service. Only one of the access points can be used at a certain time. To conserve memory, I always shut down the remaining subsystems whenever a connection is active.
With Nimble, I have an unavoidable memory leak, since there is no removal equivalent to ble_l2cap_coc_create_server
. ble_l2cap_coc_create_server
allocates a structure and appends it to the global list of L2CAP servers. I don't see why we shouldn't have a corresponding ble_l2cap_coc_remove_server
that removes the L2CAP server from the static list and frees the memory allocated for the structure.