Loading libs/binder/RpcServer.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -124,8 +124,13 @@ size_t RpcServer::getMaxThreads() { return mMaxThreads; } void RpcServer::setProtocolVersion(uint32_t version) { bool RpcServer::setProtocolVersion(uint32_t version) { if (!RpcState::validateProtocolVersion(version)) { return false; } mProtocolVersion = version; return true; } void RpcServer::setSupportedFileDescriptorTransportModes( Loading libs/binder/RpcSession.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -104,11 +104,7 @@ size_t RpcSession::getMaxOutgoingThreads() { } bool RpcSession::setProtocolVersionInternal(uint32_t version, bool checkStarted) { if (version >= RPC_WIRE_PROTOCOL_VERSION_NEXT && version != RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL) { ALOGE("Cannot start RPC session with version %u which is unknown (current protocol version " "is %u).", version, RPC_WIRE_PROTOCOL_VERSION); if (!RpcState::validateProtocolVersion(version)) { return false; } Loading libs/binder/RpcState.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,18 @@ status_t RpcState::rpcRec( return OK; } bool RpcState::validateProtocolVersion(uint32_t version) { if (version >= RPC_WIRE_PROTOCOL_VERSION_NEXT && version != RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL) { ALOGE("Cannot use RPC binder protocol version %u which is unknown (current protocol " "version " "is %u).", version, RPC_WIRE_PROTOCOL_VERSION); return false; } return true; } status_t RpcState::readNewSessionResponse(const sp<RpcSession::RpcConnection>& connection, const sp<RpcSession>& session, uint32_t* version) { RpcNewSessionResponse response; Loading libs/binder/RpcState.h +2 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ public: RpcState(); ~RpcState(); [[nodiscard]] static bool validateProtocolVersion(uint32_t version); [[nodiscard]] status_t readNewSessionResponse(const sp<RpcSession::RpcConnection>& connection, const sp<RpcSession>& session, uint32_t* version); [[nodiscard]] status_t sendConnectionInit(const sp<RpcSession::RpcConnection>& connection, Loading libs/binder/include/binder/RpcServer.h +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ public: * used. However, this can be used in order to prevent newer protocol * versions from ever being used. This is expected to be useful for testing. */ void setProtocolVersion(uint32_t version); [[nodiscard]] bool setProtocolVersion(uint32_t version); /** * Set the supported transports for sending and receiving file descriptors. Loading Loading
libs/binder/RpcServer.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -124,8 +124,13 @@ size_t RpcServer::getMaxThreads() { return mMaxThreads; } void RpcServer::setProtocolVersion(uint32_t version) { bool RpcServer::setProtocolVersion(uint32_t version) { if (!RpcState::validateProtocolVersion(version)) { return false; } mProtocolVersion = version; return true; } void RpcServer::setSupportedFileDescriptorTransportModes( Loading
libs/binder/RpcSession.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -104,11 +104,7 @@ size_t RpcSession::getMaxOutgoingThreads() { } bool RpcSession::setProtocolVersionInternal(uint32_t version, bool checkStarted) { if (version >= RPC_WIRE_PROTOCOL_VERSION_NEXT && version != RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL) { ALOGE("Cannot start RPC session with version %u which is unknown (current protocol version " "is %u).", version, RPC_WIRE_PROTOCOL_VERSION); if (!RpcState::validateProtocolVersion(version)) { return false; } Loading
libs/binder/RpcState.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,18 @@ status_t RpcState::rpcRec( return OK; } bool RpcState::validateProtocolVersion(uint32_t version) { if (version >= RPC_WIRE_PROTOCOL_VERSION_NEXT && version != RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL) { ALOGE("Cannot use RPC binder protocol version %u which is unknown (current protocol " "version " "is %u).", version, RPC_WIRE_PROTOCOL_VERSION); return false; } return true; } status_t RpcState::readNewSessionResponse(const sp<RpcSession::RpcConnection>& connection, const sp<RpcSession>& session, uint32_t* version) { RpcNewSessionResponse response; Loading
libs/binder/RpcState.h +2 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,8 @@ public: RpcState(); ~RpcState(); [[nodiscard]] static bool validateProtocolVersion(uint32_t version); [[nodiscard]] status_t readNewSessionResponse(const sp<RpcSession::RpcConnection>& connection, const sp<RpcSession>& session, uint32_t* version); [[nodiscard]] status_t sendConnectionInit(const sp<RpcSession::RpcConnection>& connection, Loading
libs/binder/include/binder/RpcServer.h +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ public: * used. However, this can be used in order to prevent newer protocol * versions from ever being used. This is expected to be useful for testing. */ void setProtocolVersion(uint32_t version); [[nodiscard]] bool setProtocolVersion(uint32_t version); /** * Set the supported transports for sending and receiving file descriptors. Loading