Merge remote-tracking branch 'origin/sctp_nodelay' into integration_2025_w14_p1 (!3352)

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
This commit is contained in:
Robert Schmidt
2025-04-03 10:14:07 +02:00
+7
View File
@@ -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));