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

Commit a26e64af authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder: RPC reject excess threads" am: 153f30b9 am: 1627c9c3 am:...

Merge "libbinder: RPC reject excess threads" am: 153f30b9 am: 1627c9c3 am: 12b7b34f am: 3ab3ce39

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1785490

Change-Id: I19152a83391ce978bb87869e3affa47cbccc65b7
parents 79cf8ce8 3ab3ce39
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -629,6 +629,12 @@ bool RpcSession::setForServer(const wp<RpcServer>& server, const wp<EventListene
sp<RpcSession::RpcConnection> RpcSession::assignIncomingConnectionToThisThread(unique_fd fd) {
sp<RpcSession::RpcConnection> RpcSession::assignIncomingConnectionToThisThread(unique_fd fd) {
    std::lock_guard<std::mutex> _l(mMutex);
    std::lock_guard<std::mutex> _l(mMutex);


    if (mIncomingConnections.size() >= mMaxThreads) {
        ALOGE("Cannot add thread to session with %zu threads (max is set to %zu)",
              mIncomingConnections.size(), mMaxThreads);
        return nullptr;
    }

    // Don't accept any more connections, some have shutdown. Usually this
    // Don't accept any more connections, some have shutdown. Usually this
    // happens when new connections are still being established as part of a
    // happens when new connections are still being established as part of a
    // very short-lived session which shuts down after it already started
    // very short-lived session which shuts down after it already started