MYNEWT-754 BLE host - Store cb can abort iterate.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f0a1ea83 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f0a1ea83 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f0a1ea83 Branch: refs/heads/master Commit: f0a1ea83726a488734c7ad957ef7c2ac956a42b4 Parents: c2654f3 Author: Christopher Collins <[email protected]> Authored: Thu May 11 14:36:11 2017 -0700 Committer: Christopher Collins <[email protected]> Committed: Thu May 11 18:00:20 2017 -0700 ---------------------------------------------------------------------- net/nimble/host/src/ble_store.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f0a1ea83/net/nimble/host/src/ble_store.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_store.c b/net/nimble/host/src/ble_store.c index e70a5bd..2fa5461 100644 --- a/net/nimble/host/src/ble_store.c +++ b/net/nimble/host/src/ble_store.c @@ -268,7 +268,11 @@ void ble_store_iterate(int obj_type, /* read error or no more entries */ break; } else if (callback) { - callback(obj_type, &value, cookie); + rc = callback(obj_type, &value, cookie); + if (rc != 0) { + /* User function indicates to stop iterating. */ + break; + } } idx++; }
