Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions nimble/host/src/ble_l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ int
ble_l2cap_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
struct os_mbuf *sdu_rx, ble_l2cap_event_fn *cb, void *cb_arg)
{
return ble_l2cap_sig_coc_connect(conn_handle, psm, mtu, sdu_rx, cb, cb_arg);
int rc;

ble_hs_lock();
rc = ble_l2cap_sig_connect_nolock(conn_handle, psm, mtu, sdu_rx, cb, cb_arg);
ble_hs_unlock();

return rc;
}

int
Expand Down Expand Up @@ -183,15 +189,22 @@ ble_l2cap_enhanced_connect(uint16_t conn_handle,
uint8_t num, struct os_mbuf *sdu_rx[],
ble_l2cap_event_fn *cb, void *cb_arg)
{
return ble_l2cap_sig_ecoc_connect(conn_handle, psm, mtu,
num, sdu_rx, cb, cb_arg);
int rc;

ble_hs_lock();
rc = ble_l2cap_sig_ecoc_connect_nolock(conn_handle, psm, mtu, num, sdu_rx,
cb, cb_arg);
ble_hs_unlock();

return rc;
}

int
ble_l2cap_reconfig(struct ble_l2cap_chan *chans[], uint8_t num, uint16_t new_mtu)
{
int i;
uint16_t conn_handle;
int rc;

if (num == 0 || !chans) {
return BLE_HS_EINVAL;
Expand All @@ -206,13 +219,23 @@ ble_l2cap_reconfig(struct ble_l2cap_chan *chans[], uint8_t num, uint16_t new_mtu
}
}

return ble_l2cap_sig_coc_reconfig(conn_handle, chans, num, new_mtu);
ble_hs_lock();
rc = ble_l2cap_sig_coc_reconfig_nolock(conn_handle, chans, num, new_mtu);
ble_hs_unlock();

return rc;
}

int
ble_l2cap_disconnect(struct ble_l2cap_chan *chan)
{
return ble_l2cap_sig_disconnect(chan);
int rc;

ble_hs_lock();
rc = ble_l2cap_sig_disconnect_nolock(chan);
ble_hs_unlock();

return rc;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion nimble/host/src/ble_l2cap_coc.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,8 @@ ble_l2cap_coc_le_credits_update(uint16_t conn_handle, uint16_t dcid,

if (chan->coc_tx.credits + credits > 0xFFFF) {
BLE_HS_LOG(INFO, "LE CoC credits overflow...disconnecting\n");
ble_l2cap_sig_disconnect_nolock(chan);
ble_hs_unlock();
ble_l2cap_sig_disconnect(chan);
return;
}

Expand Down
Loading
Loading