trx_if: Allow calling trx_if_flush/close from within TRXC callback

Change-Id: Ic3baa95ffe4e6ca95c6d02276ea8eb0cb9fa0064
This commit is contained in:
Pau Espin 2021-09-20 19:02:44 +02:00 committed by pespin
parent 3bf40e4f3a
commit 4444262a6a
1 changed files with 9 additions and 6 deletions

View File

@ -707,6 +707,13 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
rsp.cb = tcm->cb;
/* Remove command from list, save it to last_acked and remove previous
* last_acked. Do it before calling callback to avoid user freeing tcm
* pointer if flushing/closing the iface. */
llist_del(&tcm->list);
talloc_free(l1h->last_acked);
l1h->last_acked = tcm;
/* check for response code */
rc = trx_ctrl_rx_rsp(l1h, &rsp, tcm);
if (rc == -EINVAL)
@ -714,15 +721,11 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
/* re-schedule last cmd in rc seconds time */
if (rc > 0) {
osmo_timer_schedule(&l1h->trx_ctrl_timer, rc, 0);
if (!llist_empty(&l1h->trx_ctrl_list))
osmo_timer_schedule(&l1h->trx_ctrl_timer, rc, 0);
return 0;
}
/* remove command from list, save it to last_acked and removed previous last_acked */
llist_del(&tcm->list);
talloc_free(l1h->last_acked);
l1h->last_acked = tcm;
trx_ctrl_send(l1h);
return 0;