refactor(admin): Release handle lock before command execution

Change admin service handle to SyncRwLock and copy the handler

function pointer before awaiting execution to prevent deadlock.
This commit is contained in:
Jade Ellis committed 2026-10-28 21:45:18 +00:00
1 parent 35d606eeb7
commit 938b3d2825
3 files changed
+13 -15

No files matched your search

+4 -8
View File
@@ -39,17 +39,13 @@ conduwuit::mod_dtor! {}
pub use crate::admin::AdminCommand;
/// Install the admin command processor
pub async fn init(admin_service: &service::admin::Service) {
pub fn init(admin_service: &service::admin::Service) {
_ = admin_service.complete.write().insert(processor::complete);
_ = admin_service
.handle
.write()
.await
.insert(processor::dispatch);
_ = admin_service.handle.write().insert(processor::dispatch);
}
/// Uninstall the admin command handler
pub async fn fini(admin_service: &service::admin::Service) {
_ = admin_service.handle.write().await.take();
pub fn fini(admin_service: &service::admin::Service) {
_ = admin_service.handle.write().take();
_ = admin_service.complete.write().take();
}