pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email )
Change subject: osmo_iofd_register: fix the case of changing fd
......................................................................
osmo_iofd_register: fix the case of changing fd
Doxygen description for this function states:
\param[in] fd the system fd number that will be registered.
If you did not yet specify the file descriptor number during
osmo_fd_setup(), or if it has changed since then, you can state
the [new] file descriptor number as argument.
If you wish to proceed with the previously specified file descriptor
number, pass -1.
However, the case where a new fd is passed to osmo_iofd_register()
while the structure contains an old (but unregistered) fd was not
handled correctly: the code would proceed with re-registering the old
fd, ignoring the newly passed one.
Fixes: df1ee8568b97dbf6d5268a83d1715a1c1fffb2de
Change-Id: If8b8486ad7934afa203dfe1e996c9217373a017b
---
M src/core/osmo_io.c
1 file changed, 13 insertions(+), 11 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index e109cdf..286ae24 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -746,21 +746,23 @@
{
int rc = 0;
- if (fd < 0 && iofd->fd < 0) {
+ if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) {
+ /* If re-registering same fd, handle as NO-OP.
+ * And it is an even more explicit NO-OP
+ * if the caller passed in -1. */
+ if (fd < 0 || fd == iofd->fd)
+ return 0;
+ /* New FD should go through unregister() first. */
+ return -ENOTSUP;
+ }
+
+ if (fd >= 0)
+ iofd->fd = fd;
+ if (iofd->fd < 0) {
/* this might happen if both osmo_iofd_setup() and osmo_iofd_register() are called with -1 */
LOGPIO(iofd, LOGL_ERROR, "Cannot register io_fd using invalid fd == %d\n", iofd->fd);
return -EBADF;
}
- if (fd < 0)
- fd = iofd->fd;
- else if (iofd->fd < 0)
- iofd->fd = fd;
-
- if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED)) {
- /* If re-registering same fd, handle as NO-OP.
- * New FD should go through unregister() first. */
- return iofd->fd == fd ? 0 : -ENOTSUP;
- }
rc = osmo_iofd_ops.register_fd(iofd);
if (rc)
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8b8486ad7934afa203dfe1e996c9217373a017b
Gerrit-Change-Number: 39276
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: falconia.
pespin has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email )
Change subject: osmo_iofd_register: fix the case of changing fd
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8b8486ad7934afa203dfe1e996c9217373a017b
Gerrit-Change-Number: 39276
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: falconia <falcon(a)freecalypso.org>
Gerrit-Comment-Date: Fri, 10 Jan 2025 13:05:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: falconia.
laforge has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email )
Change subject: osmo_iofd_register: fix the case of changing fd
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39276?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If8b8486ad7934afa203dfe1e996c9217373a017b
Gerrit-Change-Number: 39276
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: falconia <falcon(a)freecalypso.org>
Gerrit-Comment-Date: Fri, 10 Jan 2025 13:05:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcap/+/39283?usp=email )
Change subject: server: Rename func client_data() -> zmq_send_client_data()
......................................................................
server: Rename func client_data() -> zmq_send_client_data()
Change-Id: I1b22046464cf969fb5d74b6c2580aaec1feffefa
---
M src/osmo_server_network.c
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/83/39283/1
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index f05413e..64d772a 100644
--- a/src/osmo_server_network.c
+++ b/src/osmo_server_network.c
@@ -89,8 +89,8 @@
pcap_zmq_send(conn->server->zmq_publ, data, strlen(data), 0);
}
-static void client_data(struct osmo_pcap_conn *conn,
- struct osmo_pcap_data *data)
+static void zmq_send_client_data(struct osmo_pcap_conn *conn,
+ struct osmo_pcap_data *data)
{
char *event_name;
@@ -101,7 +101,7 @@
* This multi-part support is insane... so if we lose the first
* or the last part of the multipart message stuff is going out
* of sync. *great* As we can't do anything about it right now
- * just close the eyese and send it.
+ * just close the eyes and send it.
*/
event_name = talloc_asprintf(conn, "data.v1.%s", conn->name);
pcap_zmq_send(conn->server->zmq_publ, event_name, strlen(event_name), ZMQ_SNDMORE);
@@ -466,7 +466,7 @@
time_t now = time(NULL);
int rc;
- client_data(conn, data);
+ zmq_send_client_data(conn, data);
if (!conn->store) {
update_last_write(conn, now);
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/39283?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I1b22046464cf969fb5d74b6c2580aaec1feffefa
Gerrit-Change-Number: 39283
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/39279?usp=email )
Change subject: src/Makefile.am cosmetic: make it easier to extend
......................................................................
src/Makefile.am cosmetic: make it easier to extend
To make it easier to add new source files to libosmonetif_la_SOURCES
list, make two cosmetic changes to it:
* List stream.c before stream_{cli,srv}.c, matching the order
that is used in other similar instances;
* Use $(NULL) construct so that every source-naming line ends
with a backslash.
Change-Id: I98cf6d592fb66d5f22d486358ccdab06306ae3b0
---
M src/Makefile.am
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
diff --git a/src/Makefile.am b/src/Makefile.am
index bd3f272..e3634be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,9 +23,10 @@
prim.c \
rs232.c \
rtp.c \
+ stream.c \
stream_cli.c \
stream_srv.c \
- stream.c
+ $(NULL)
if ENABLE_LIBSCTP
libosmonetif_la_SOURCES += sctp.c
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/39279?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I98cf6d592fb66d5f22d486358ccdab06306ae3b0
Gerrit-Change-Number: 39279
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>