Change in libosmo-netif[master]: examples: Use osmo_stream_*_set_nodelay in ipa examples

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

daniel gerrit-no-reply at lists.osmocom.org
Thu Oct 15 13:00:26 UTC 2020


daniel has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/20643 )

Change subject: examples: Use osmo_stream_*_set_nodelay in ipa examples
......................................................................

examples: Use osmo_stream_*_set_nodelay in ipa examples

We have functions to help with/abstract the nodelay settings so use
those.

Change-Id: Icb143c6e5fc3063f942a744deb576865674a4c62
---
M examples/ipa-stream-client.c
M examples/ipa-stream-server.c
2 files changed, 2 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index ec7d2b3..0c9c589 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -186,21 +186,13 @@
 	osmo_stream_cli_set_disconnect_cb(conn, disconnect_cb);
 	osmo_stream_cli_set_read_cb(conn, read_cb);
 	osmo_stream_cli_set_data(conn, &num_msgs);
+	osmo_stream_cli_set_nodelay(conn, true);
 
 	if (osmo_stream_cli_open(conn) < 0) {
 		fprintf(stderr, "cannot open client\n");
 		exit(EXIT_FAILURE);
 	}
 
-	int on = 1, ret;
-	struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn);
-
-	ret = setsockopt(ofd->fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
-	if (ret < 0) {
-		LOGP(DIPATEST, LOGL_ERROR, "cannot disable Nagle\n");
-		exit(EXIT_FAILURE);
-	}
-
 	LOGP(DIPATEST, LOGL_NOTICE, "Entering main loop\n");
 
 	while(1) {
diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c
index e774b31..c311697 100644
--- a/examples/ipa-stream-server.c
+++ b/examples/ipa-stream-server.c
@@ -117,21 +117,13 @@
 	osmo_stream_srv_link_set_addr(srv, "127.0.0.1");
 	osmo_stream_srv_link_set_port(srv, 10000);
 	osmo_stream_srv_link_set_accept_cb(srv, accept_cb);
-
-	int on = 1, ret;
-	struct osmo_fd *ofd = osmo_stream_srv_link_get_ofd(srv);
+	osmo_stream_srv_link_set_nodelay(srv, true);
 
 	if (osmo_stream_srv_link_open(srv) < 0) {
 		fprintf(stderr, "cannot open client\n");
 		exit(EXIT_FAILURE);
 	}
 
-	ret = setsockopt(ofd->fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
-	if (ret < 0) {
-		LOGP(DSTREAMTEST, LOGL_ERROR, "cannot disable Nagle\n");
-		exit(EXIT_FAILURE);
-	}
-
 	LOGP(DSTREAMTEST, LOGL_NOTICE, "Entering main loop\n");
 
 	while(1) {

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/20643
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Icb143c6e5fc3063f942a744deb576865674a4c62
Gerrit-Change-Number: 20643
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201015/35fb9ecb/attachment.htm>


More information about the gerrit-log mailing list