BLE Host - Don't allow conn to already-conned peer
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/5ae196a9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5ae196a9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5ae196a9 Branch: refs/heads/nrf_cputime Commit: 5ae196a95248b3531f7e3c940f0444df78d3e554 Parents: 537b220 Author: Christopher Collins <ccoll...@apache.org> Authored: Tue Mar 28 16:32:25 2017 -0700 Committer: Christopher Collins <ccoll...@apache.org> Committed: Tue Mar 28 16:58:41 2017 -0700 ---------------------------------------------------------------------- net/nimble/host/src/ble_gap.c | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5ae196a9/net/nimble/host/src/ble_gap.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c index ed71374..9d7d0f0 100644 --- a/net/nimble/host/src/ble_gap.c +++ b/net/nimble/host/src/ble_gap.c @@ -2384,6 +2384,12 @@ ble_gap_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr, goto done; } + /* Verify peer not already connected. */ + if (ble_hs_conn_find_by_addr(peer_addr) != NULL) { + rc = BLE_HS_EDONE; + goto done; + } + if (!ble_hs_conn_can_alloc()) { rc = BLE_HS_ENOMEM; goto done;