Attention is currently required from: pespin.

fixeria uploaded patch set #7 to this change.

View Change

The following approvals got outdated and were removed: Code-Review+1 by pespin, Verified+1 by Jenkins Builder

libosmo-trx/ep: flush pending TRXC messages on endpoint teardown

osmo_trx_ep_close() used to drop any still-queued ctrl socket Tx data
via osmo_iofd_free(), including a 'goodbye' TRXC message (i.e. "CMD
POWEROFF") that may have just been enqueued right before teardown.

Track bytes still pending on each channel's ctrl_iofd (ctrl_wr_pending)
and, if any remain at close() time, swap the iofd's write_cb instead of
freeing it right away: keep waiting until every enqueued byte has
actually completed (or a write fails), then finally free it. Data
sockets and pending Tx data batches (TRXDv2 batching) are still
dropped immediately, as before.

Expose the "still flushing" state via the new osmo_trx_ep_is_closing(),
so a caller can tell it apart from fully closed: re-opening the same
ports while a flush is still in flight would otherwise risk a confusing
EADDRINUSE, so osmo_trx_ep_open() and osmo_trx_ep_set_num_chans() now
return -EBUSY in that case. osmo_trx_ep_free() called while still
closing reparents the whole endpoint to OTC_GLOBAL and defers the
actual free until the last flush completes, instead of dropping
the still-in-flight state.

This follows the async-flush pattern used by osmo-pcap's
osmo_pcap_wr_file_flush()/_is_flushing(), adapted to the osmo_io API
(there is no osmo_iofd_flush()).

Change-Id: I69e6a3bcf49afc3cfca4a72afdf459625cb91e56
---
M libosmo-trx/include/osmocom/trx/ep.h
M libosmo-trx/src/trx_ep.c
M tests/libosmo-trx/trx_ep_test.c
M tests/libosmo-trx/trx_ep_test.err
M tests/libosmo-trx/trx_ep_test.ok
5 files changed, 297 insertions(+), 10 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/12/43112/7

To view, visit change 43112. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I69e6a3bcf49afc3cfca4a72afdf459625cb91e56
Gerrit-Change-Number: 43112
Gerrit-PatchSet: 7
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-Attention: pespin <pespin@sysmocom.de>