host: Free txq on connection free, not atomic del

This commit just moves a bit of code from one function to another.
Previously, a connection's transmit queue was freed in
`ble_hs_atomic_conn_delete()`.  This operation is more logically placed
in the more "leaf" function `ble_hs_conn_free()`.
This commit is contained in:
Christopher Collins
2019-03-25 14:00:58 +01:00
committed by Łukasz Rymanowski
parent 20e65503e8
commit e1b77b4ac1
2 changed files with 6 additions and 7 deletions
-7
View File
@@ -23,17 +23,10 @@ int
ble_hs_atomic_conn_delete(uint16_t conn_handle)
{
struct ble_hs_conn *conn;
struct os_mbuf_pkthdr *omp;
ble_hs_lock();
conn = ble_hs_conn_find(conn_handle);
if (conn != NULL) {
while ((omp = STAILQ_FIRST(&conn->bhc_tx_q)) != NULL) {
STAILQ_REMOVE_HEAD(&conn->bhc_tx_q, omp_next);
os_mbuf_free_chain(OS_MBUF_PKTHDR_TO_MBUF(omp));
}
ble_hs_conn_remove(conn);
ble_hs_conn_free(conn);
+6
View File
@@ -207,6 +207,7 @@ ble_hs_conn_free(struct ble_hs_conn *conn)
#endif
struct ble_l2cap_chan *chan;
struct os_mbuf_pkthdr *omp;
int rc;
if (conn == NULL) {
@@ -219,6 +220,11 @@ ble_hs_conn_free(struct ble_hs_conn *conn)
ble_hs_conn_delete_chan(conn, chan);
}
while ((omp = STAILQ_FIRST(&conn->bhc_tx_q)) != NULL) {
STAILQ_REMOVE_HEAD(&conn->bhc_tx_q, omp_next);
os_mbuf_free_chain(OS_MBUF_PKTHDR_TO_MBUF(omp));
}
#if MYNEWT_VAL(BLE_HS_DEBUG)
memset(conn, 0xff, sizeof *conn);
#endif