Bug #5948
openFix socket (-write) functions in multiple projects (by moving them to a common library...)
0%
Description
I've had a short exchange with pespin concerning usage of osmo_fd_write_disable()
, resulting in him submitting a patch (https://gerrit.osmocom.org/c/osmo-bts/+/31924), since existing code had been quite suboptimal.
Currently, the socket write function in osmo-bts has been fixed, but while grepping I found a couple of functions that all take a struct osmo_fd *
and pretty much contain the same code owing to copy pasta:
osmo-trx/Transceiver52M/device/ipc/ipc_sock.c: ipc_sock_write() osmo-trx/Transceiver52M/device/ipc/ipc_chan.c: ipc_chan_sock_write() osmocom-bb/src/host/layer23/src/mobile/mncc_sock.c: mncc_sock_write() osmo-msc/src/libmsc/mncc_sock.c: mncc_sock_write() osmo-pcu/src/osmobts_sock.c: pcu_sock_write() osmo-bsc/src/osmo-bsc/pcu_sock.c: pcu_sock_write()
I have compared them a bit and it very much seems that they all do the same (except for differences that would be left out when applying changes like pespin's patch above) and, going by the patch linked above, should be replaced by some new library function (libosmocore?).
I would also guess that a lot of the other functions in those files dealing with reading and sending messages on that socket share such similarities as well.
What I already see as up to debate is whether or not that should be combined with a transition to the use of Osmocom write queues similar to what is being asked for in https://projects.osmocom.org/issues/5774
Also where to put such a function, (we might want to keep msgb
and socket
code in libosmocore independent of each other).
Files
Related issues
Updated by laforge 9 months ago
- Related to Feature #5751: io_uring support in libosmocore added