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

Commit a321b3cb authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Disallow setMaxThreads of size > 1 for single-threaded binder RPC

Bug: 410035138
Flag: EXEMPT trivial change
Test: Presubmit
Change-Id: I93acdc2427d767803cac51e5f8bd64c9025ade8c
parent bbf0e156
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ status_t RpcServer::setupInetServer(const char* address, unsigned int port,
}

void RpcServer::setMaxThreads(size_t threads) {
#ifdef BINDER_RPC_SINGLE_THREADED
    LOG_ALWAYS_FATAL_IF(threads > 1, "Cannot set max threads > 1 in single-threaded mode");
#endif // BINDER_RPC_SINGLE_THREADED
    LOG_ALWAYS_FATAL_IF(threads <= 0, "RpcServer is useless without threads");
    LOG_ALWAYS_FATAL_IF(mJoinThreadRunning, "Cannot set max threads while running");
    mMaxThreads = threads;
@@ -260,7 +263,6 @@ status_t RpcServer::recvmsgSocketConnection(const RpcServer& server, RpcTranspor
}

void RpcServer::join() {

    {
        RpcMutexLockGuard _l(mLock);
        LOG_ALWAYS_FATAL_IF(!mServer.fd.ok(), "RpcServer must be setup to join.");