diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-01-03 14:19:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-01-03 14:19:37 +0100 |
commit | 05442a9cdc3feaecfe27ed537b36de81818ae522 (patch) | |
tree | 34590989b716e28168b63ec71fb1694feb92fd04 /src/core/socket.c | |
parent | edcd8ae3abf7b28dd9d572b55a34589f4da5f055 (diff) | |
parent | 62bc4efc7a617791d43f4e6cbef857554e6dbe2e (diff) |
Merge pull request #2245 from ssahani/socket1
core: socket options fix SCTP_NODELAY
Diffstat (limited to 'src/core/socket.c')
-rw-r--r-- | src/core/socket.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index d6b0c963e8..2e4173aabc 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -28,9 +28,9 @@ #include <sys/epoll.h> #include <sys/stat.h> #include <unistd.h> +#include <linux/sctp.h> #include "sd-event.h" - #include "alloc-util.h" #include "bus-error.h" #include "bus-util.h" @@ -877,8 +877,14 @@ static void socket_apply_socket_options(Socket *s, int fd) { if (s->no_delay) { int b = s->no_delay; - if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &b, sizeof(b)) < 0) - log_unit_warning_errno(UNIT(s), errno, "TCP_NODELAY failed: %m"); + + if (s->socket_protocol == IPPROTO_SCTP) { + if (setsockopt(fd, SOL_SCTP, SCTP_NODELAY, &b, sizeof(b)) < 0) + log_unit_warning_errno(UNIT(s), errno, "SCTP_NODELAY failed: %m"); + } else { + if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &b, sizeof(b)) < 0) + log_unit_warning_errno(UNIT(s), errno, "TCP_NODELAY failed: %m"); + } } if (s->broadcast) { |