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 2020/04/23 18:17:50 UTC

[GitHub] [mynewt-nimble] h2zero commented on a change in pull request #783: Make ble_gap_rx_l2cap_update_req() behave like ble_gap_rx_param_req()

h2zero commented on a change in pull request #783:
URL: https://github.com/apache/mynewt-nimble/pull/783#discussion_r414019801



##########
File path: nimble/host/src/ble_gap.c
##########
@@ -1806,15 +1806,40 @@ int
 ble_gap_rx_l2cap_update_req(uint16_t conn_handle,
                             struct ble_gap_upd_params *params)
 {
+    struct ble_gap_upd_params self_params;
     struct ble_gap_event event;
     int rc;
 
+    /* Copy the peer params into the self params to make it easy on the
+     * application.  The application callback will change only the fields which
+     * it finds unsuitable.
+     */
+    self_params = *params;
+
     memset(&event, 0, sizeof event);
     event.type = BLE_GAP_EVENT_L2CAP_UPDATE_REQ;
     event.conn_update_req.conn_handle = conn_handle;
+    event.conn_update_req.self_params = &self_params;
     event.conn_update_req.peer_params = params;
 
     rc = ble_gap_call_conn_event_cb(&event, conn_handle);
+
+    if ((self_params.itvl_min <= self_params.itvl_max)
+         && (self_params.itvl_min >= params->itvl_min)
+         && (self_params.itvl_max <= params->itvl_max)) {
+             params->itvl_max = self_params.itvl_max;
+             params->itvl_min = self_params.itvl_min;
+    }
+
+    if ((self_params.min_ce_len <= self_params.max_ce_len)

Review comment:
       Unless I'm mistaken we probably shouldn't restrict the min/max_ce_len values as they are not requested by the peer and actually just initialized [here](https://github.com/apache/mynewt-nimble/blob/6ced1dd4ca63e6f0bd2df7dcc558afcc2896f1c2/nimble/host/src/ble_l2cap_sig.c#L414) to:
   ```
       params.min_ce_len = BLE_GAP_INITIAL_CONN_MIN_CE_LEN;
       params.max_ce_len = BLE_GAP_INITIAL_CONN_MAX_CE_LEN;
   ```
   before this gets called.




----------------------------------------------------------------
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