diff --git a/CHANGELOG.md b/CHANGELOG.md index 50a1a277..57c5d9f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [14.5.0] - 2026-06-04 +- Add deregister_generic_rpc() + ## [14.5.0] - 2026-06-03 - Shared awaitable diff --git a/conanfile.py b/conanfile.py index fd03849f..84ad962a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -10,7 +10,7 @@ class SISLConan(ConanFile): name = "sisl" - version = "14.5.0" + version = "14.6.0" homepage = "https://github.com/eBay/sisl" description = "Library for fast data structures, utilities" diff --git a/include/sisl/grpc/rpc_server.hpp b/include/sisl/grpc/rpc_server.hpp index 0372fec3..1e967583 100644 --- a/include/sisl/grpc/rpc_server.hpp +++ b/include/sisl/grpc/rpc_server.hpp @@ -129,6 +129,11 @@ class GrpcServer : private boost::noncopyable { void run_generic_completion_cb(const std::string& rpc_name, boost::intrusive_ptr< GenericRpcData >& rpc_data); bool register_async_generic_service(); bool register_generic_rpc(const std::string& name, const generic_rpc_handler_cb_t& rpc_handler); + // Remove a previously registered generic RPC handler so the server stops dispatching it (returns true if an + // entry was removed). New calls for `name` get UNIMPLEMENTED via run_generic_handler_cb; this does NOT drain a + // handler already executing (run_generic_handler_cb releases the registry lock before invoking the cb), so the + // caller must ensure no in-flight handler outlives any state the cb captures. + bool deregister_generic_rpc(const std::string& name); private: void handle_rpcs(uint32_t thread_num, const rpc_thread_start_cb_t& thread_start_cb); diff --git a/src/grpc/rpc_server.cpp b/src/grpc/rpc_server.cpp index d901cec4..99eec42f 100644 --- a/src/grpc/rpc_server.cpp +++ b/src/grpc/rpc_server.cpp @@ -227,6 +227,14 @@ bool GrpcServer::register_generic_rpc(const std::string& name, const generic_rpc return true; } +bool GrpcServer::deregister_generic_rpc(const std::string& name) { + // Drop the handler from the dispatch registry; subsequent run_generic_handler_cb lookups for `name` miss and + // return UNIMPLEMENTED. The per-cq GenericRpcData accept slots are generic (not per-method), so they are left + // in place to keep serving the remaining registered methods. + std::unique_lock< std::shared_mutex > lock(m_generic_rpc_registry_mtx); + return m_generic_rpc_registry.erase(name) > 0; +} + // RPCHelper static methods bool RPCHelper::has_server_shutdown(const GrpcServer* server) {