diff options
| -rw-r--r-- | libs/binder/RpcServer.cpp | 2 | ||||
| -rw-r--r-- | libs/binder/RpcSession.cpp | 4 | ||||
| -rw-r--r-- | libs/binder/RpcTransportRaw.cpp | 2 | ||||
| -rw-r--r-- | libs/binder/include/binder/RpcTransport.h | 7 |
4 files changed, 10 insertions, 5 deletions
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp index a0c508be03..a20445b7d7 100644 --- a/libs/binder/RpcServer.cpp +++ b/libs/binder/RpcServer.cpp @@ -260,7 +260,7 @@ void RpcServer::establishConnection(sp<RpcServer>&& server, base::unique_fd clie status_t status = OK; int clientFdForLog = clientFd.get(); - auto client = server->mCtx->newTransport(std::move(clientFd)); + auto client = server->mCtx->newTransport(std::move(clientFd), server->mShutdownTrigger.get()); if (client == nullptr) { ALOGE("Dropping accept4()-ed socket because sslAccept fails"); status = DEAD_OBJECT; diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 7799da22c6..4ee0128c92 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -160,7 +160,7 @@ status_t RpcSession::addNullDebuggingClient() { ALOGE("Unable to create RpcTransportCtx for null debugging client"); return NO_MEMORY; } - auto server = ctx->newTransport(std::move(serverFd)); + auto server = ctx->newTransport(std::move(serverFd), mShutdownTrigger.get()); if (server == nullptr) { ALOGE("Unable to set up RpcTransport"); return UNKNOWN_ERROR; @@ -536,7 +536,7 @@ status_t RpcSession::initAndAddConnection(unique_fd fd, const RpcAddress& sessio mRpcTransportCtxFactory->toCString()); return NO_MEMORY; } - auto server = ctx->newTransport(std::move(fd)); + auto server = ctx->newTransport(std::move(fd), mShutdownTrigger.get()); if (server == nullptr) { ALOGE("Unable to set up RpcTransport in %s context", mRpcTransportCtxFactory->toCString()); return UNKNOWN_ERROR; diff --git a/libs/binder/RpcTransportRaw.cpp b/libs/binder/RpcTransportRaw.cpp index 46170f7f7a..d77fc52c61 100644 --- a/libs/binder/RpcTransportRaw.cpp +++ b/libs/binder/RpcTransportRaw.cpp @@ -108,7 +108,7 @@ private: // RpcTransportCtx with TLS disabled. class RpcTransportCtxRaw : public RpcTransportCtx { public: - std::unique_ptr<RpcTransport> newTransport(android::base::unique_fd fd) const { + std::unique_ptr<RpcTransport> newTransport(android::base::unique_fd fd, FdTrigger*) const { return std::make_unique<RpcTransportRaw>(std::move(fd)); } }; diff --git a/libs/binder/include/binder/RpcTransport.h b/libs/binder/include/binder/RpcTransport.h index afca5854d9..1b6951986e 100644 --- a/libs/binder/include/binder/RpcTransport.h +++ b/libs/binder/include/binder/RpcTransport.h @@ -56,8 +56,13 @@ protected: class RpcTransportCtx { public: virtual ~RpcTransportCtx() = default; + + // Create a new RpcTransport object. + // + // Implemenion details: for TLS, this function may incur I/O. |fdTrigger| may be used + // to interrupt I/O. This function blocks until handshake is finished. [[nodiscard]] virtual std::unique_ptr<RpcTransport> newTransport( - android::base::unique_fd fd) const = 0; + android::base::unique_fd fd, FdTrigger *fdTrigger) const = 0; protected: RpcTransportCtx() = default; |