diff options
author | Elliott Hughes <enh@google.com> | 2016-08-23 12:50:00 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-08-23 12:50:00 -0700 |
commit | 3dcfa3fb1cec36b21ad026c618c85790a2353f72 (patch) | |
tree | b5f5daae853a2c420873b40f92d4f18175d96abd /libsysutils | |
parent | 82b67fff06363c8e7a17058cb5ce748f21a27f11 (diff) | |
download | system_core-3dcfa3fb1cec36b21ad026c618c85790a2353f72.tar.gz system_core-3dcfa3fb1cec36b21ad026c618c85790a2353f72.tar.bz2 system_core-3dcfa3fb1cec36b21ad026c618c85790a2353f72.zip |
Most accept/accept4 calls in system/core don't actually want the remote address.
So don't write the extra code for it or waste the kernel's time
copying it around.
Change-Id: I93de64064c2d4fe58ba5b5322cfa69bf31a76dad
Diffstat (limited to 'libsysutils')
-rw-r--r-- | libsysutils/src/SocketListener.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp index 4d602a6aa..608abaea5 100644 --- a/libsysutils/src/SocketListener.cpp +++ b/libsysutils/src/SocketListener.cpp @@ -199,16 +199,7 @@ void SocketListener::runListener() { continue; } if (mListen && FD_ISSET(mSock, &read_fds)) { - sockaddr_storage ss; - sockaddr* addrp = reinterpret_cast<sockaddr*>(&ss); - socklen_t alen; - int c; - - do { - alen = sizeof(ss); - c = accept4(mSock, addrp, &alen, SOCK_CLOEXEC); - SLOGV("%s got %d from accept", mSocketName, c); - } while (c < 0 && errno == EINTR); + int c = TEMP_FAILURE_RETRY(accept4(mSock, nullptr, nullptr, SOCK_CLOEXEC)); if (c < 0) { SLOGE("accept failed (%s)", strerror(errno)); sleep(1); |