move flow control to btc layer

defer free slot in btc layer when receive BTA_JV_RFCOMM_CLOSE_EVT
This commit is contained in:
liqigan
2020-08-20 13:19:22 +08:00
parent eff892933c
commit 14f48d35bd
12 changed files with 314 additions and 80 deletions

View File

@@ -210,17 +210,17 @@ void port_release_port (tPORT *p_port)
osi_mutex_global_lock();
RFCOMM_TRACE_DEBUG("port_release_port, p_port:%p", p_port);
if (p_port->rx.queue) {
if (p_port->rx.queue != NULL) {
while ((p_buf = (BT_HDR *)fixed_queue_dequeue(p_port->rx.queue, 0)) != NULL) {
osi_free (p_buf);
osi_free(p_buf);
}
}
p_port->rx.queue_size = 0;
if (p_port->tx.queue) {
if (p_port->tx.queue != NULL) {
while ((p_buf = (BT_HDR *)fixed_queue_dequeue(p_port->tx.queue, 0)) != NULL) {
osi_free (p_buf);
}
osi_free(p_buf);
}
}
p_port->tx.queue_size = 0;
@@ -514,10 +514,12 @@ void port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count)
&& (p_port->credit_rx_max > p_port->credit_rx)) {
rfc_send_credit(p_port->rfc.p_mcb, p_port->dlci,
(UINT8) (p_port->credit_rx_max - p_port->credit_rx));
RFCOMM_TRACE_DEBUG("send credit: max %d, rx %d, count %d", p_port->credit_rx_max, p_port->credit_rx, count);
p_port->credit_rx = p_port->credit_rx_max;
p_port->rx.peer_fc = FALSE;
} else {
RFCOMM_TRACE_DEBUG("credit: max %d, rx %d, low %d", p_port->credit_rx_max, p_port->credit_rx, p_port->credit_rx_low);
}
}
/* else want to disable flow from peer */