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

Commit 2830f5bd authored by Archie Pusaka's avatar Archie Pusaka
Browse files

Floss: Use SOCK_STREAM for L2CAP socket

Previously we uses SOCK_SEQPACKET but there is no clear advantage
of using it. Additionally we use SOCK_STREAM everywhere else.
This CL makes Floss uses SOCK_STREAM.

Bug: 271828292
Test: Pass CTSV BLE CoC Client Test
Change-Id: I8d9beaf7800477d356be9b8bedf8959c412e731b
parent 1957c7ca
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -269,6 +269,7 @@ static l2cap_socket* btsock_l2cap_alloc_l(const char* name,
  unsigned security = 0;
  int fds[2];
  l2cap_socket* sock = (l2cap_socket*)osi_calloc(sizeof(*sock));
  int sock_type = SOCK_SEQPACKET;

  if (flags & BTSOCK_FLAG_ENCRYPT)
    security |= is_server ? BTM_SEC_IN_ENCRYPT : BTM_SEC_OUT_ENCRYPT;
@@ -279,7 +280,12 @@ static l2cap_socket* btsock_l2cap_alloc_l(const char* name,
  if (flags & BTSOCK_FLAG_AUTH_16_DIGIT)
    security |= BTM_SEC_IN_MIN_16_DIGIT_PIN;

  if (socketpair(AF_LOCAL, SOCK_SEQPACKET, 0, fds)) {
    // For Floss, set socket as SOCK_STREAM
    // TODO(b:271828292): Set SOCK_STREAM for everyone after verification tests
#if TARGET_FLOSS
  sock_type = SOCK_STREAM;
#endif
  if (socketpair(AF_LOCAL, sock_type, 0, fds)) {
    LOG_ERROR("socketpair failed:%s", strerror(errno));
    goto fail_sockpair;
  }