feat(secure): a lot of things

This commit is contained in:
DJMrTV 2025-02-06 17:54:38 +01:00
commit 2b9f55e4d2
24 changed files with 435 additions and 98 deletions

View file

@ -1,15 +1,16 @@
use std::io::Cursor;
use std::sync::Arc;
use tokio::sync::Mutex;
use log::info;
use tokio::sync::{Mutex, RwLock};
use crate::protocols::matchmake_common::MatchmakeData;
use crate::prudp::socket::ConnectionData;
use crate::prudp::socket::{ConnectionData, SocketData};
use crate::rmc::message::RMCMessage;
use crate::rmc::response::{ErrorCode, RMCResponseResult};
use crate::rmc::structures::RmcSerialize;
type PIDList = Vec<u32>;
async fn get_playing_session(rmcmessage: &RMCMessage, data: Arc<Mutex<MatchmakeData>>) -> RMCResponseResult {
async fn get_playing_session(rmcmessage: &RMCMessage, data: Arc<RwLock<MatchmakeData>>) -> RMCResponseResult {
//todo: propperly implement this
let cheeseburger = PIDList::new();
@ -21,12 +22,14 @@ async fn get_playing_session(rmcmessage: &RMCMessage, data: Arc<Mutex<MatchmakeD
rmcmessage.success_with_data(vec)
}
pub async fn get_playing_session_raw_params(rmcmessage: &RMCMessage, _: &mut ConnectionData, data: Arc<Mutex<MatchmakeData>>) -> RMCResponseResult{
pub async fn get_playing_session_raw_params(rmcmessage: &RMCMessage, _: &Arc<SocketData>, _: &Arc<Mutex<ConnectionData>>, data: Arc<RwLock<MatchmakeData>>) -> RMCResponseResult{
let mut reader = Cursor::new(&rmcmessage.rest_of_data);
let Ok(list) = PIDList::deserialize(&mut reader) else {
return rmcmessage.error_result_with_code(ErrorCode::FPD_FriendNotExists);
};
info!("get_playing_session got called with {:?}", list);
get_playing_session(rmcmessage, data).await
}