summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2023-03-08 11:13:27 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-03-08 11:13:27 +0000
commite3b1b568174dafc8bdebc1ca45e6d45ba6ea55c9 (patch)
tree2a4c498c272ae6fd15aa67d87dc3d8e7c7afad0b
parentdd051f640057a1240f467a9b87f048923915d174 (diff)
parent942245ea97084b7d48c9111aa558488a5a391473 (diff)
downloadnative-e3b1b568174dafc8bdebc1ca45e6d45ba6ea55c9.tar.gz
Merge "RPC Binder: disable Nagle's algorithm" am: 942245ea97
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2474467 Change-Id: I70d51714777d58f2fbe52c2f7ac1b832868a2a93 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/RpcSession.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 233a8e4b86..fbad0f7756 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -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()))) {