Attention is currently required from: falconia.
pespin has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmo-netif/+/39281?usp=email )
Change subject: bring twrtp into libosmo-netif ......................................................................
Patch Set 8: Code-Review+1
(1 comment)
File src/twrtp.c:
https://gerrit.osmocom.org/c/libosmo-netif/+/39281/comment/d0ba04ac_a8e510b1... : PS7, Line 348: return 0;
I am not smart enough to find a way to do it cleanly. […]
This already cleans quite a lot of close() churn imho:
int osmo_twrtp_supply_fds(struct osmo_twrtp *endp, int rtp_fd, int rtcp_fd) { int rc; if (endp->iofd_rtp) { rc = -EBUSY; goto close_both_ret; } endp->iofd_rtp = osmo_iofd_setup(endp, -1, NULL, OSMO_IO_FD_MODE_RECVFROM_SENDTO, &twrtp_iops_rtp, endp); if (!endp->iofd_rtp) { rc = -EIO; goto close_both_ret; } osmo_iofd_set_alloc_info(endp->iofd_rtp, MAX_RTP_RX_PACKET, 0); rc = osmo_iofd_register(endp->iofd_rtp, rtp_fd); if (rc < 0) { osmo_iofd_free(endp->iofd_rtp); endp->iofd_rtp = NULL; goto close_both_ret; } if (rtcp_fd >= 0) { endp->iofd_rtcp = osmo_iofd_setup(endp, -1, NULL, OSMO_IO_FD_MODE_RECVFROM_SENDTO, &twrtp_iops_rtcp, endp); if (!endp->iofd_rtcp) { osmo_iofd_free(endp->iofd_rtp); endp->iofd_rtp = NULL; rc = -EIO; goto close_rtcp_ret; } osmo_iofd_set_alloc_info(endp->iofd_rtcp, MAX_RTCP_RX_PACKET, 0); rc = osmo_iofd_register(endp->iofd_rtcp, rtcp_fd); if (rc < 0) { osmo_iofd_free(endp->iofd_rtp); osmo_iofd_free(endp->iofd_rtcp); endp->iofd_rtp = NULL; endp->iofd_rtcp = NULL; goto close_rtcp_ret; } } return 0;
close_both_ret: close(rtp_fd); close_rtcp_ret: if (rtcp_fd >= 0) close(rtcp_fd); return rc; }