Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a521a0f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Avoid out-of-order L2CAP CoC callbacks on channel creation"

parents ef49ef26 784d750b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ fn parse_hci_adapter(flags: &mut InitFlags, values: Vec<&str>) {
init_flags!(
    // LINT.IfChange
    flags: {
        asynchronously_start_l2cap_coc = true,
        btaa_hci = true,
        btm_dm_flush_discovery_queue_on_search_cancel,
        finite_att_timeout = true,
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ mod ffi {
        fn load(flags: Vec<String>);
        fn set_all_for_testing();

        fn asynchronously_start_l2cap_coc_is_enabled() -> bool;
        fn btaa_hci_is_enabled() -> bool;
        fn btm_dm_flush_discovery_queue_on_search_cancel_is_enabled() -> bool;
        fn finite_att_timeout_is_enabled() -> bool;
+14 −3
Original line number Diff line number Diff line
@@ -33,11 +33,13 @@
#include <string>

#include "device/include/controller.h"  // TODO Remove
#include "gd/common/init_flags.h"
#include "main/shim/shim.h"
#include "osi/include/allocator.h"
#include "osi/include/log.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/btu.h"  // do_in_main_thread
#include "stack/include/l2c_api.h"
#include "stack/l2cap/l2c_int.h"
#include "types/raw_address.h"
@@ -563,9 +565,18 @@ uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
  if (p_lcb->link_state == LST_CONNECTED) {
    if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE) {
      L2CAP_TRACE_DEBUG("%s LE Link is up", __func__);
      // post this asynchronously to avoid out-of-order callback invocation
      // should this operation fail
      if (bluetooth::common::init_flags::
              asynchronously_start_l2cap_coc_is_enabled()) {
        do_in_main_thread(FROM_HERE,
                          base::Bind(&l2c_csm_execute, base::Unretained(p_ccb),
                                     L2CEVT_L2CA_CONNECT_REQ, nullptr));
      } else {
        l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_REQ, NULL);
      }
    }
  }

  /* If link is disconnecting, save link info to retry after disconnect
   * Possible Race condition when a reconnect occurs
@@ -843,8 +854,8 @@ std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,
 *
 *  Description      Start reconfigure procedure on Connection Oriented Channel.
 *
 *  Parameters:      Vector of channels for which configuration should be changed
 *                   New local channel configuration
 *  Parameters:      Vector of channels for which configuration should be
 *changed New local channel configuration
 *
 *  Return value:    true if peer is connected
 *