Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12af6f73 authored by Steven Moreland's avatar Steven Moreland
Browse files

RPC Binder: disable Nagle's algorithm

For some reason, I thought we did this - I thought it was
incidental to some other API we used. RPC Binder is an RPC
system, AND ONE WITH SYNCHRONOUS CALLS! It should not hold
these packets.

Bug: 271860373
Test: run inet cases before/after:
    binderRpcTest --gtest_filter="*PerSocket/BinderRpc.RepeatBinderNull/inet_socket_tls_clientV0_serverV4026531840_single_threaded_no_kernel*"
    before: 0m26.845s
    after: 0m12.271s

Change-Id: Ib257b53cd2e4ca19041cdb5fd985be346e3fac5e
parent 65fac116
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <dlfcn.h>
#include <inttypes.h>
#include <netinet/tcp.h>
#include <poll.h>
#include <unistd.h>

@@ -608,6 +609,18 @@ status_t RpcSession::setupOneSocketConnection(const RpcSocketAddress& addr,
            return -savedErrno;
        }

        if (addr.addr()->sa_family == AF_INET || addr.addr()->sa_family == AF_INET6) {
            int noDelay = 1;
            int result =
                    setsockopt(serverFd.get(), IPPROTO_TCP, TCP_NODELAY, &noDelay, sizeof(noDelay));
            if (result < 0) {
                int savedErrno = errno;
                ALOGE("Could not set TCP_NODELAY on %s: %s", addr.toString().c_str(),
                      strerror(savedErrno));
                return -savedErrno;
            }
        }

        RpcTransportFd transportFd(std::move(serverFd));

        if (0 != TEMP_FAILURE_RETRY(connect(transportFd.fd.get(), addr.addr(), addr.addrSize()))) {