libbinder: RpcServer: remove acceptOne
Singlely used function, no longer needed.
Bug: N/A
Test: binderRpcTest
Change-Id: Id7fa463d532c997db78b5cf3eab5c7d8e8f17d51
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 5ffee06..2f378da 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -153,7 +153,22 @@
status_t status;
while ((status = mShutdownTrigger->triggerablePollRead(mServer)) == OK) {
- (void)acceptOne();
+ unique_fd clientFd(TEMP_FAILURE_RETRY(
+ accept4(mServer.get(), nullptr, nullptr /*length*/, SOCK_CLOEXEC)));
+
+ if (clientFd < 0) {
+ ALOGE("Could not accept4 socket: %s", strerror(errno));
+ continue;
+ }
+ LOG_RPC_DETAIL("accept4 on fd %d yields fd %d", mServer.get(), clientFd.get());
+
+ {
+ std::lock_guard<std::mutex> _l(mLock);
+ std::thread thread =
+ std::thread(&RpcServer::establishConnection, sp<RpcServer>::fromExisting(this),
+ std::move(clientFd));
+ mConnectingThreads[thread.get_id()] = std::move(thread);
+ }
}
LOG_RPC_DETAIL("RpcServer::join exiting with %s", statusToString(status).c_str());
@@ -164,26 +179,6 @@
mShutdownCv.notify_all();
}
-bool RpcServer::acceptOne() {
- unique_fd clientFd(
- TEMP_FAILURE_RETRY(accept4(mServer.get(), nullptr, nullptr /*length*/, SOCK_CLOEXEC)));
-
- if (clientFd < 0) {
- ALOGE("Could not accept4 socket: %s", strerror(errno));
- return false;
- }
- LOG_RPC_DETAIL("accept4 on fd %d yields fd %d", mServer.get(), clientFd.get());
-
- {
- std::lock_guard<std::mutex> _l(mLock);
- std::thread thread = std::thread(&RpcServer::establishConnection,
- sp<RpcServer>::fromExisting(this), std::move(clientFd));
- mConnectingThreads[thread.get_id()] = std::move(thread);
- }
-
- return true;
-}
-
bool RpcServer::shutdown() {
std::unique_lock<std::mutex> _l(mLock);
if (mShutdownTrigger == nullptr) {