Use SO_SNDBUFFORCE instead of SO_SNDBUF

When /proc/sys/net/core/wmem_max is smaller than kMaxMessageSize, we
need to override the limitation.

Bug: 37561460
Test: libappfuse_tests

Change-Id: Ibaac8db61290d661459fdc46f0ae8416f7db1d9e
This commit is contained in:
Daichi Hirono 2017-04-28 16:55:29 +09:00
parent df54d0efc3
commit 287776ddf4

View file

@ -141,8 +141,8 @@ bool SetupMessageSockets(base::unique_fd (*result)[2]) {
}
constexpr int kMaxMessageSize = sizeof(FuseBuffer);
if (setsockopt(fds[0], SOL_SOCKET, SO_SNDBUF, &kMaxMessageSize, sizeof(int)) != 0 ||
setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, &kMaxMessageSize, sizeof(int)) != 0) {
if (setsockopt(fds[0], SOL_SOCKET, SO_SNDBUFFORCE, &kMaxMessageSize, sizeof(int)) != 0 ||
setsockopt(fds[1], SOL_SOCKET, SO_SNDBUFFORCE, &kMaxMessageSize, sizeof(int)) != 0) {
PLOG(ERROR) << "Failed to update buffer size for socket";
return false;
}