From b9bfac8c70ff43485a4593d19300591987558754 Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 28 Apr 2026 15:22:42 +0200 Subject: [PATCH] implement find by single id --- rnex-core/src/nex/user.rs | 11 +++++++++++ rnex-core/src/rmc/protocols/matchmake.rs | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/rnex-core/src/nex/user.rs b/rnex-core/src/nex/user.rs index 7b56fdf..7f0bf41 100644 --- a/rnex-core/src/nex/user.rs +++ b/rnex-core/src/nex/user.rs @@ -52,6 +52,8 @@ use rnex_core::rmc::structures::ranking::UploadCompetitionData; use std::sync::{Arc, Weak}; use tokio::sync::{Mutex, RwLock}; +use crate::rmc::structures::Error; + cfg_if! { if #[cfg(feature = "datastore")] { use rnex_core::rmc::protocols::datastore::{DataStore, RawDataStore, RawDataStoreInfo, RemoteDataStore}; @@ -509,6 +511,15 @@ impl MatchmakeExtension for User { } impl Matchmake for User { + async fn find_by_single_id(&self, gid: u32) -> Result<(bool, Any), ErrorCode> { + let s = self.matchmake_manager.get_session(gid).await?; + let s = s.lock().await; + Ok(( + true, + Any::new(&s.session).map_err(|_| ErrorCode::Custom_Unknown)?, + )) + } + async fn unregister_gathering(&self, _gid: u32) -> Result { Ok(true) } diff --git a/rnex-core/src/rmc/protocols/matchmake.rs b/rnex-core/src/rmc/protocols/matchmake.rs index 94edce3..d1c43b9 100644 --- a/rnex-core/src/rmc/protocols/matchmake.rs +++ b/rnex-core/src/rmc/protocols/matchmake.rs @@ -4,10 +4,14 @@ use rnex_core::rmc::response::ErrorCode; use rnex_core::PID; +use crate::rmc::structures::any::Any; + #[rmc_proto(21)] pub trait Matchmake { #[method_id(2)] async fn unregister_gathering(&self, gid: u32) -> Result; + #[method_id(21)] + async fn find_by_single_id(&self, gid: u32) -> Result<(bool, Any), ErrorCode>; #[method_id(41)] async fn get_session_urls(&self, gid: u32) -> Result, ErrorCode>; #[method_id(42)]