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

Commit 29bbbc40 authored by Alice Wang's avatar Alice Wang Committed by Automerger Merge Worker
Browse files

Merge "[rpc_binder] Adjust return when raw socket is not set up" am:...

Merge "[rpc_binder] Adjust return when raw socket is not set up" am: 97970145 am: 4fbdec5b am: c5daaa16

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



Change-Id: I86d39a42ab0887565adb796b58d22b2cddcce968
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7fff5cdb c5daaa16
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -565,12 +565,9 @@ status_t RpcServer::setupSocketServer(const RpcSocketAddress& addr) {
}

status_t RpcServer::setupRawSocketServer(base::unique_fd socket_fd) {
    LOG_ALWAYS_FATAL_IF(!socket_fd.ok(), "Socket must be setup to listen.");
    RpcTransportFd transportFd(std::move(socket_fd));
    if (!transportFd.fd.ok()) {
        int savedErrno = errno;
        ALOGE("Could not get initialized Unix socket: %s", strerror(savedErrno));
        return -savedErrno;
    }

    // Right now, we create all threads at once, making accept4 slow. To avoid hanging the client,
    // the backlog is increased to a large number.
    // TODO(b/189955605): Once we create threads dynamically & lazily, the backlog can be reduced
+4 −0
Original line number Diff line number Diff line
@@ -94,6 +94,10 @@ bool RunInitUnixDomainRpcServer(AIBinder* service, const char* name,
                                void (*readyCallback)(void* param), void* param) {
    auto server = RpcServer::make();
    auto fd = unique_fd(android_get_control_socket(name));
    if (!fd.ok()) {
        LOG(ERROR) << "Failed to get fd for the socket:" << name;
        return false;
    }
    if (status_t status = server->setupRawSocketServer(std::move(fd)); status != OK) {
        LOG(ERROR) << "Failed to set up Unix Domain RPC server with name " << name
                   << " error: " << statusToString(status).c_str();