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

Commit 3291bbed authored by Mehmet Murat Sevim's avatar Mehmet Murat Sevim Committed by Automerger Merge Worker
Browse files

Merge "Fix potential data loss when writing to congested L2CAP CoC." am:...

Merge "Fix potential data loss when writing to congested L2CAP CoC." am: dc47be77 am: cde94275 am: 546c201f

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2041484



Change-Id: Id5257c3b1f322b2d7e12a39efc71215a1ff0e074
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents fbc022c2 546c201f
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -442,10 +442,11 @@ static int process_cmd_sock(int h) {
  return true;
}

static void process_data_sock(int h, struct pollfd* pfds, int count) {
  asrt(count <= ts[h].poll_count);
static void process_data_sock(int h, struct pollfd* pfds, int pfds_count,
                              int event_count) {
  asrt(event_count <= pfds_count);
  int i;
  for (i = 1; i < ts[h].poll_count; i++) {
  for (i = 1; i < pfds_count; i++) {
    if (pfds[i].revents) {
      int ps_i = ts[h].psi[i];
      if (ts[h].ps[ps_i].pfd.fd == -1) {
@@ -512,6 +513,7 @@ static void* sock_poll_thread(void* arg) {
    }
    if (ret != 0) {
      int need_process_data_fd = true;
      int pfds_count = ts[h].poll_count;
      if (pfds[0].revents)  // cmd fd always is the first one
      {
        asrt(pfds[0].fd == ts[h].cmd_fdr);
@@ -524,7 +526,7 @@ static void* sock_poll_thread(void* arg) {
        else
          ret--;  // exclude the cmd fd
      }
      if (need_process_data_fd) process_data_sock(h, pfds, ret);
      if (need_process_data_fd) process_data_sock(h, pfds, pfds_count, ret);
    } else {
      LOG_INFO("no data, select ret: %d", ret);
    };