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

Commit ade19568 authored by Srinu Jella's avatar Srinu Jella Committed by android-build-merger
Browse files

Cleanup L2CAP socket properly on close

am: 91170676

* commit '91170676':
  Cleanup L2CAP socket properly on close
parents b1c0c8af 91170676
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -393,6 +393,7 @@ tBTA_JV_STATUS bta_jv_free_l2c_cb(tBTA_JV_L2C_CB *p_cb)
    }
    p_cb->psm = 0;
    p_cb->state = BTA_JV_ST_NONE;
    p_cb->cong = FALSE;
    bta_jv_free_sec_id(&p_cb->sec_id);
    p_cb->p_cback = NULL;
    return status;
+6 −2
Original line number Diff line number Diff line
@@ -275,9 +275,14 @@ static void btsock_l2cap_free_l(l2cap_socket *sock)
        } else {
            BTA_JvFreeChannel(sock->channel, BTA_JV_CONN_TYPE_L2CAP);
        }

        if (!sock->fixed_chan) {
           APPL_TRACE_DEBUG("%s stopping L2CAP server channel %d", __func__, sock->channel);
           BTA_JvL2capStopServer(sock->channel, UINT_TO_PTR(sock->id));
        }
    }

    APPL_TRACE_DEBUG("SOCK_LIST: free(id = %d)", sock->id);
    APPL_TRACE_DEBUG("%s: free(id = %d)", __func__, sock->id);
    osi_free(sock);
}

@@ -598,7 +603,6 @@ static void on_l2cap_close(tBTA_JV_L2CAP_CLOSE * p_close, uint32_t id)
        APPL_TRACE_DEBUG("on_l2cap_close, slot id:%d, fd:%d, %s:%d, server:%d",
                sock->id, sock->our_fd, sock->fixed_chan ? "fixed_chan" : "PSM",
                sock->channel, sock->server);
        sock->handle = 0;
        // TODO: This does not seem to be called...
        // I'm not sure if this will be called for non-server sockets?
        if(!sock->fixed_chan && (sock->server == TRUE)) {