Disconnect LE socket when the HCI connection associated is disconnected.

This commit is contained in:
Takanori Watanabe 2016-06-07 16:57:13 +00:00
parent 04a83165f2
commit b32073c458
3 changed files with 10 additions and 3 deletions

View File

@ -346,7 +346,8 @@ ng_l2cap_new_chan(ng_l2cap_p l2cap, ng_l2cap_con_p con, u_int16_t psm, int idtyp
ch->scid = ng_l2cap_get_cid(l2cap,
(con->linktype!= NG_HCI_LINK_ACL));
}
ch->idtype = idtype;
if (ch->scid != NG_L2CAP_NULL_CID) {
/* Initialize channel */
ch->psm = psm;

View File

@ -1389,7 +1389,13 @@ ng_l2cap_l2ca_discon_ind(ng_l2cap_chan_p ch)
error = ENOMEM;
else {
ip = (ng_l2cap_l2ca_discon_ind_ip *)(msg->data);
ip->lcid = ch->scid;
ip->idtype = ch->idtype;
if(ch->idtype == NG_L2CAP_L2CA_IDTYPE_ATT||
ch->idtype == NG_L2CAP_L2CA_IDTYPE_SMP)
ip->lcid = ch->con->con_handle;
else
ip->lcid = ch->scid;
NG_SEND_MSG_HOOK(error, l2cap->node, msg, l2cap->l2c, 0);
}

View File

@ -1115,7 +1115,7 @@ ng_btsocket_l2cap_process_l2ca_discon_ind(struct ng_mesg *msg,
/* Look for the socket with given channel ID */
pcb = ng_btsocket_l2cap_pcb_by_cid(&rt->src, ip->lcid,
NG_L2CAP_L2CA_IDTYPE_BREDR);
ip->idtype);
if (pcb == NULL) {
mtx_unlock(&ng_btsocket_l2cap_sockets_mtx);
return (0);