BLE Host - Don't assume leading space in l2cap tx.

Call os_mbuf_prepend_pullup() rather than calling os_mbuf_prepend() and
assuming the resulting buffer is the same as the input.


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/409c0671
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/409c0671
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/409c0671

Branch: refs/heads/develop
Commit: 409c06710021f9afd98955e008ed5f46dbede237
Parents: 5897ba9
Author: Christopher Collins <[email protected]>
Authored: Fri Aug 5 12:19:15 2016 -0700
Committer: Christopher Collins <[email protected]>
Committed: Sat Aug 6 14:15:59 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/409c0671/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index 66bad51..43ccd6f 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -119,16 +119,14 @@ struct os_mbuf *
 ble_l2cap_prepend_hdr(struct os_mbuf *om, uint16_t cid, uint16_t len)
 {
     struct ble_l2cap_hdr hdr;
-    struct os_mbuf *om2;
 
     htole16(&hdr.blh_len, len);
     htole16(&hdr.blh_cid, cid);
 
-    om2 = os_mbuf_prepend(om, sizeof hdr);
-    if (om2 == NULL) {
+    om = os_mbuf_prepend_pullup(om, sizeof hdr);
+    if (om == NULL) {
         return NULL;
     }
-    BLE_HS_DBG_ASSERT(om2 == om);
 
     memcpy(om->om_data, &hdr, sizeof hdr);
 

Reply via email to