summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-27 18:58:02 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-27 18:58:02 +0100
commit7d9eaa8461da2a4ef5ae840f41a3434c112dae37 (patch)
tree6ebc50007b7af5c71f11ca891d129d5b51e7941a /src/socket.c
parentbb99a35a873c35e80b0b47fe045081022660374d (diff)
socket: if SO_RCVBUFFORCE fails, fall back to SO_RCVBUF, to have at least a little effect
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c
index 7409aea5ee..67cd0cce8e 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -680,14 +680,19 @@ static void socket_apply_socket_options(Socket *s, int fd) {
if (s->receive_buffer > 0) {
int value = (int) s->receive_buffer;
+
+ /* We first try with SO_RCVBUFFORCE, in case we have the perms for that */
+
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUFFORCE, &value, sizeof(value)) < 0)
- log_warning("SO_RCVBUFFORCE failed: %m");
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) < 0)
+ log_warning("SO_RCVBUF failed: %m");
}
if (s->send_buffer > 0) {
int value = (int) s->send_buffer;
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0)
- log_warning("SO_SNDBUFFORCE failed: %m");
+ if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) < 0)
+ log_warning("SO_SNDBUF failed: %m");
}
if (s->mark >= 0)