mickeyl commented on issue #1741:
URL: https://github.com/apache/mynewt-nimble/issues/1741#issuecomment-2027394324

   I looked a bit further and I think a client workaround seems unlikely, since 
this pretty much happens inside NimBLE.
   
   In `ble_l2cap_coc:492` it says
   
   ```c
           conn = ble_hs_conn_find_assert(chan->conn_handle);
           rc = ble_l2cap_tx(conn, chan, txom);
   
           if (rc) {
               /* txom is consumed by l2cap */
               txom = NULL;
               goto failed;
           } else {
               tx->credits--;
               tx->data_offset += len - sdu_size_offset;
           }
   ```
   
   `ble_hs_conn_find_assert` is supposed to trigger an assertion in debug code, 
when the `conn_handle` is nowhere to be found in the active connections. For 
production code, this doesn't happen -- and an assertion surely is too much of 
a weapon here. I suppose something along the lines of:
   
   ```c
           conn = ble_hs_conn_find_assert(chan->conn_handle);
           if (!conn) {
               /* txom is consumed by l2cap */
               txom = NULL;
               goto failed;
           }
           rc = ble_l2cap_tx(conn, chan, txom);
   
           if (rc) {
               /* txom is consumed by l2cap */
               txom = NULL;
               goto failed;
           } else {
               tx->credits--;
               tx->data_offset += len - sdu_size_offset;
           }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to