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

Commit 52543528 authored by Jack He's avatar Jack He Committed by android-build-merger
Browse files

L2CAP Socket: Keep track of last allocated socket ID

am: 9a703ceb

Change-Id: I65aafab76ca7c140e678e51f7272e7323dab0c0a
parents 12b57bce 9a703ceb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ static void btsock_l2cap_server_listen(l2cap_socket* sock);
static std::mutex state_lock;

l2cap_socket* socks = NULL;
static uint32_t last_sock_id = 0;
static uid_set_t* uid_set = NULL;
static int pth = -1;

@@ -327,7 +328,7 @@ static l2cap_socket* btsock_l2cap_alloc_l(const char* name,
  sock->next = socks;
  sock->prev = NULL;
  if (socks) socks->prev = sock;
  sock->id = (socks ? socks->id : 0) + 1;
  sock->id = last_sock_id + 1;
  sock->tx_bytes = 0;
  sock->rx_bytes = 0;
  socks = sock;
@@ -345,6 +346,7 @@ static l2cap_socket* btsock_l2cap_alloc_l(const char* name,
    if (!++sock->id) /* no zero IDs allowed */
      sock->id++;
  }
  last_sock_id = sock->id;
  DVLOG(2) << __func__ << " SOCK_LIST: alloc id:" << sock->id;
  return sock;