mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-06 05:14:45 +00:00
feat(nimble): Added option to disable automatically sending extra credits to peer
This commit is contained in:
@@ -283,7 +283,7 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
|
||||
* However, we still have buffer to for next LE Frame so lets give one more
|
||||
* credit to peer so it can send us full SDU
|
||||
*/
|
||||
if (rx->credits == 0) {
|
||||
if (chan->disable_auto_credit_update == false && rx->credits == 0) {
|
||||
/* Remote did not send full SDU. Lets give him one more credits to do
|
||||
* so since we have still buffer to handle it
|
||||
*/
|
||||
@@ -598,7 +598,7 @@ ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
|
||||
/* We want to back only that much credits which remote side is missing
|
||||
* to be able to send complete SDU.
|
||||
*/
|
||||
if (chan->coc_rx.credits < c->initial_credits) {
|
||||
if (chan->disable_auto_credit_update == false && chan->coc_rx.credits < c->initial_credits) {
|
||||
ble_hs_unlock();
|
||||
ble_l2cap_sig_le_credits(chan->conn_handle, chan->scid,
|
||||
c->initial_credits - chan->coc_rx.credits);
|
||||
|
||||
@@ -92,6 +92,19 @@ struct ble_l2cap_chan {
|
||||
struct ble_l2cap_coc_endpoint coc_rx;
|
||||
struct ble_l2cap_coc_endpoint coc_tx;
|
||||
uint16_t initial_credits;
|
||||
/**
|
||||
* Disable automatically sending credits to a remote
|
||||
*
|
||||
* This field disables automatically sending extra credit to a
|
||||
* remote that has exhausted all of its available credits.
|
||||
* Setting this field to "true" will enable behaviour to
|
||||
* "not automatically send credits to a peer whose credits are exhausted"
|
||||
* Setting this field to "false" will enable behaviour to
|
||||
* "automatically send credits to a peer whose credits are exhausted"
|
||||
* this behaviour.
|
||||
*
|
||||
*/
|
||||
bool disable_auto_credit_update;
|
||||
ble_l2cap_event_fn *cb;
|
||||
void *cb_arg;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user