fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/43112?usp=email )
Change subject: libosmo-trx/ep: flush pending TRXC messages on endpoint teardown
......................................................................
libosmo-trx/ep: flush pending TRXC messages on endpoint teardown
osmo_iofd_write_msgb() only enqueues the message; the actual
transmission happens asynchronously from within osmo_select_main().
An application sending a 'goodbye' command (like "CMD POWEROFF")
immediately before tearing down the endpoint would thus lose it:
osmo_iofd_free() discards the pending Tx queue.
Flush the TRXC Tx queue (best-effort) in osmo_trx_ep_close(), using
the new osmo_iofd_flush() API. Pending Tx data batches are still
dropped, since queued bursts are worthless at teardown time.
Depends: libosmocore.git I4e09e91e472a4441977a2c199c07c2cb8005632f
Change-Id: I69e6a3bcf49afc3cfca4a72afdf459625cb91e56
---
M libosmo-trx/src/trx_ep.c
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/12/43112/1
diff --git a/libosmo-trx/src/trx_ep.c b/libosmo-trx/src/trx_ep.c
index 77b6ca0..a2011c9 100644
--- a/libosmo-trx/src/trx_ep.c
+++ b/libosmo-trx/src/trx_ep.c
@@ -350,7 +350,9 @@
return -EIO;
}
-/*! Close all sockets of the given endpoint (drops pending Tx batches) */
+/*! Close all sockets of the given endpoint.
+ * Pending TRXC messages ('goodbye' commands like POWEROFF) are flushed
+ * to the socket (best-effort); pending Tx data batches are dropped. */
void osmo_trx_ep_close(struct osmo_trx_ep *ep)
{
LOGEP(ep, LOGL_NOTICE, "Closing TRXC/TRXD connections
l=%s:%u<->r=%s:%u\n",
@@ -363,6 +365,8 @@
for (unsigned int i = 0; i < ep->cfg.num_chans; i++) {
struct osmo_trx_ep_chan *chan = &ep->chans[i];
+ if (chan->ctrl_iofd != NULL)
+ osmo_iofd_flush(chan->ctrl_iofd);
osmo_iofd_free(chan->ctrl_iofd);
chan->ctrl_iofd = NULL;
osmo_iofd_free(chan->data_iofd);
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43112?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I69e6a3bcf49afc3cfca4a72afdf459625cb91e56
Gerrit-Change-Number: 43112
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>