mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-06 01:57:56 +00:00
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:
committed by
Łukasz Rymanowski
parent
20e65503e8
commit
e1b77b4ac1
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user