net: bt: Disconnect in case of errors sending a packet

Packets shall never fail to be sent now that they are queued, so if an
error occured there is no point in keep the channel connected.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-11-19 10:33:25 +02:00 committed by Johan Hedberg
parent cf84216b1a
commit f93de735d2

View file

@ -114,6 +114,8 @@ static int net_bt_send(struct net_if *iface, struct net_pkt *pkt)
ret = bt_l2cap_chan_send(&conn->ipsp_chan.chan, buffer);
if (ret < 0) {
NET_ERR("Unable to send packet: %d", ret);
bt_l2cap_chan_disconnect(&conn->ipsp_chan.chan);
return ret;
}