From b6e06e8f47fa2a4aa61ad4d010857e6f3cf0fb9a Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Apr 2025 21:28:48 +0100 Subject: [PATCH] Turn off any Nagle-like algorithm for SCTP This means that packets will be sent as soon as possible and no unnecessary delays are introduced, at the cost of more packets in the network. https://www.man7.org/linux/man-pages/man7/sctp.7.html --- openair3/SCTP/sctp_common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openair3/SCTP/sctp_common.c b/openair3/SCTP/sctp_common.c index 66ffbec18a..5d22f19908 100644 --- a/openair3/SCTP/sctp_common.c +++ b/openair3/SCTP/sctp_common.c @@ -63,6 +63,13 @@ int sctp_set_init_opt(int sd, uint16_t instreams, uint16_t outstreams, return -1; } + int flag = 1; + if (setsockopt(sd, IPPROTO_SCTP, SCTP_NODELAY, &flag, sizeof(flag)) < 0) { + SCTP_ERROR("setsockopt SCTP_NODELAY failed: %d:%s\n", errno, strerror(errno)); + close(sd); + return -1; + } + /* Allow socket reuse */ if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) { SCTP_ERROR("setsockopt SO_REUSEADDR failed (%d:%s)\n", errno, strerror(errno));