You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/11/21 12:35:44 UTC

[GitHub] [mynewt-nimble] rymanluk commented on issue #650: host/l2cap_coc: fix receiving of frames with size 1

rymanluk commented on issue #650: host/l2cap_coc: fix receiving of frames with size 1
URL: https://github.com/apache/mynewt-nimble/pull/650#issuecomment-557065688
 
 
   > Moved the `pullup` call into the handling for the first frame, looks much neater now.
   > 
   > Doing this, I was wondering if something like the following might also be a (slightly) more efficient variant:
   > 
   > ```c
   > uint8_t tmp[2];
   > os_mbuf_copydata(om, 0, 2, tmp);
   > sdu_len = get_le16(tmp);
   > ```
   > 
   > if I understand correctly, the `os_mbuf_copdata()` takes care of reading the data independent on how its fragmented over mbuf boundaries?!
   
   I'm not sure if we should bother as in most of cases `ble_hs_mbuf_pullup_base()` will do 2 checks eventually:
   
   ```
       if (OS_MBUF_PKTLEN(*om) < base_len) {
           return BLE_HS_EBADDATA;
       }
   ```
   
   and in  `os_mbuf_pullup()` it will endup here.
    ```     
   if (om->om_len >= len) {
           return (om);
       }
   ```
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services