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?usp=email : 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; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/39281?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib63215aaf13ef8ab8f2e0c8d310164cd5c8824eb Gerrit-Change-Number: 39281 Gerrit-PatchSet: 8 Gerrit-Owner: falconia <fal...@freecalypso.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-Attention: falconia <fal...@freecalypso.org> Gerrit-Comment-Date: Mon, 01 Sep 2025 17:15:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: falconia <fal...@freecalypso.org> Comment-In-Reply-To: pespin <pes...@sysmocom.de>