aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-10-14 18:05:40 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2020-10-14 18:05:40 +0200
commit384b8f15cba3a78c274940cecc23b8947d1dee91 (patch)
tree32890c0bc3edc81538c3e5f5ccdd3c63f45324d6 /examples
parentd89fb543179cc43da63af940a084ee5dcc40f1f3 (diff)
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
Diffstat (limited to 'examples')
-rw-r--r--examples/ipa-stream-client.c10
-rw-r--r--examples/ipa-stream-server.c10
2 files changed, 2 insertions, 18 deletions
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 @@ int main(int argc, char *argv[])
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 @@ int main(void)
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) {