[S] Change in libosmocore[master]: osmo_io: Add possibility to resend a message
arehbein has abandoned this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email ) Change subject: osmo_io: Add possibility to resend a message .. Abandoned The decision has been made by Daniel and me to fix this in osmo_io_poll.c, patch is following shortly -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee Gerrit-Change-Number: 34750 Gerrit-PatchSet: 2 Gerrit-Owner: arehbein Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: pespin Gerrit-MessageType: abandon
[S] Change in libosmocore[master]: osmo_io: Add possibility to resend a message
Attention is currently required from: arehbein. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email ) Change subject: osmo_io: Add possibility to resend a message .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee Gerrit-Change-Number: 34750 Gerrit-PatchSet: 2 Gerrit-Owner: arehbein Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin Gerrit-Attention: arehbein Gerrit-Comment-Date: Mon, 16 Oct 2023 14:26:40 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in libosmocore[master]: osmo_io: Add possibility to resend a message
Attention is currently required from: pespin. arehbein has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email ) Change subject: osmo_io: Add possibility to resend a message .. Patch Set 2: (1 comment) File include/osmocom/core/osmo_io.h: https://gerrit.osmocom.org/c/libosmocore/+/34750/comment/9a6a64b8_c2a7a3c0 PS1, Line 86: int osmo_iofd_rewrite_msgb(struct osmo_io_fd *iofd, struct msgb *msg); > I'm not really liking the name of this API, it's confusing. […] Done -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee Gerrit-Change-Number: 34750 Gerrit-PatchSet: 2 Gerrit-Owner: arehbein Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Attention: pespin Gerrit-Comment-Date: Mon, 16 Oct 2023 13:46:07 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
[S] Change in libosmocore[master]: osmo_io: Add possibility to resend a message
Attention is currently required from: arehbein. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: osmo_io: Add possibility to resend a message .. osmo_io: Add possibility to resend a message Add osmo_iofd_prepend_msgb(), which works like osmo_iofd_write_msgb(), except it doesn't check the message queue length and it enqueues at the front of the message queue. Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee --- M TODO-RELEASE M include/osmocom/core/osmo_io.h M src/core/libosmocore.map M src/core/osmo_io.c 4 files changed, 48 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/34750/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee Gerrit-Change-Number: 34750 Gerrit-PatchSet: 2 Gerrit-Owner: arehbein Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Attention: arehbein Gerrit-MessageType: newpatchset
[S] Change in libosmocore[master]: osmo_io: Add possibility to resend a message
Attention is currently required from: arehbein. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email ) Change subject: osmo_io: Add possibility to resend a message .. Patch Set 1: (1 comment) File include/osmocom/core/osmo_io.h: https://gerrit.osmocom.org/c/libosmocore/+/34750/comment/c57dc922_bcf8a4ad PS1, Line 86: int osmo_iofd_rewrite_msgb(struct osmo_io_fd *iofd, struct msgb *msg); I'm not really liking the name of this API, it's confusing. Rewrite message sounds like changing the content of the msgb. The proper name would be "prepend_msgb" probably, or "reenqueue_msgb". -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee Gerrit-Change-Number: 34750 Gerrit-PatchSet: 1 Gerrit-Owner: arehbein Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Attention: arehbein Gerrit-Comment-Date: Mon, 16 Oct 2023 08:46:16 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
[S] Change in libosmocore[master]: osmo_io: Add possibility to resend a message
arehbein has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email ) Change subject: osmo_io: Add possibility to resend a message .. osmo_io: Add possibility to resend a message Add osmo_iofd_rewrite_msgb(), which works like osmo_iofd_write_msgb(), except it doesn't check the message queue length and it enqueues at the front of the message queue. Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee --- M TODO-RELEASE M include/osmocom/core/osmo_io.h M src/core/libosmocore.map M src/core/osmo_io.c 4 files changed, 48 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/34750/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index b67161d..2945c2b 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library whatdescription / commit summary line core ADD osmo_sock_multiaddr_{add,del}_local_addr() core ADD gsmtap_inst_fd2() core, DEPRECATE gsmtap_inst_fd() +core ADD osmo_iofd_rewrite_msgb() diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h index b3d248f..23335ff 100644 --- a/include/osmocom/core/osmo_io.h +++ b/include/osmocom/core/osmo_io.h @@ -83,6 +83,7 @@ void osmo_iofd_notify_connected(struct osmo_io_fd *iofd); int osmo_iofd_write_msgb(struct osmo_io_fd *iofd, struct msgb *msg); +int osmo_iofd_rewrite_msgb(struct osmo_io_fd *iofd, struct msgb *msg); int osmo_iofd_sendto_msgb(struct osmo_io_fd *iofd, struct msgb *msg, int sendto_flags, const struct osmo_sockaddr *dest); diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index e5f8bd8..6d04d34 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -278,6 +278,7 @@ osmo_iofd_uring_init; osmo_iofd_notify_connected; osmo_iofd_write_msgb; +osmo_iofd_rewrite_msgb; osmo_ip_str_type; osmo_isdnhdlc_decode; osmo_isdnhdlc_encode; diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index 2b2b7dd..894a0c1 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -381,6 +381,38 @@ return 0; } +/*! Resend a message through a connected socket. + * + * Appends the message to the front of the internal transmit queue. This function + * will always enqueue the message, even if the maximum number of messages is reached. + * This can be used to emulate Osmocom write queue API behavior (with write queues, + * if the call to the write callback returns -EAGAIN, the message buffer that failed + * to be sent is enqueued at the front of the write queue by the write queue backend). + * \param[in] iofd file descriptor to write to + * \param[in] msg message buffer to write + */ +int osmo_iofd_rewrite_msgb(struct osmo_io_fd *iofd, struct msgb *msg) +{ + if (OSMO_UNLIKELY(!iofd->io_ops.write_cb)) { + LOGPIO(iofd, LOGL_ERROR, "write_cb not set, Rejecting msgb\n"); + return -EINVAL; + } + + struct iofd_msghdr *msghdr = iofd_msghdr_alloc(iofd, IOFD_ACT_WRITE, msg); + if (!msghdr) + return -ENOMEM; + + msghdr->flags = MSG_NOSIGNAL; + msghdr->iov[0].iov_base = msgb_data(msghdr->msg); + msghdr->iov[0].iov_len = msgb_length(msghdr->msg); + msghdr->hdr.msg_iov = &msghdr->iov[0]; + msghdr->hdr.msg_iovlen = 1; + + iofd_txqueue_enqueue_front(iofd, msghdr); + + return 0; +} + /*! Send a message through an unconnected socket. * * Appends the message to the internal transmit queue. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34750?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9cc588294fcaee49e334282183672aa32fa30bee Gerrit-Change-Number: 34750 Gerrit-PatchSet: 1 Gerrit-Owner: arehbein Gerrit-MessageType: newchange