diff --git a/Cargo.lock b/Cargo.lock index 8ed2372..bcab754 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2449,6 +2449,7 @@ dependencies = [ "ctor", "rnex-rmc", "tokio", + "tracing", ] [[package]] @@ -2471,6 +2472,7 @@ version = "0.1.0" dependencies = [ "ctor", "rnex-rmc", + "tracing", ] [[package]] @@ -2503,6 +2505,7 @@ dependencies = [ "ctor", "rnex-base-protos", "rnex-rmc", + "tracing", ] [[package]] @@ -2533,6 +2536,7 @@ version = "0.1.0" dependencies = [ "ctor", "rnex-rmc", + "tracing", ] [[package]] @@ -2563,6 +2567,7 @@ dependencies = [ "rnex-base-protos", "rnex-rmc", "rnex-util", + "tracing", ] [[package]] @@ -2581,6 +2586,7 @@ version = "0.1.0" dependencies = [ "ctor", "rnex-rmc", + "tracing", ] [[package]] @@ -2615,6 +2621,7 @@ version = "0.1.0" dependencies = [ "ctor", "rnex-rmc", + "tracing", ] [[package]] @@ -2640,6 +2647,7 @@ dependencies = [ "ctor", "rnex-base-protos", "rnex-rmc", + "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4ad3c3b..7be3756 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,9 +28,12 @@ members = [ "rnex-server-nex-modules/rnex-node-holder", "rnex-server-nex-modules/rnex-base", "rnex-server-nex-modules/rnex-msg", - "rnex-server-nex-modules/rnex-auth" -, "prudpv1-proxy"] + "rnex-server-nex-modules/rnex-auth", + "prudpv1-proxy" +] +[workspace.dependencies] +tracing = "0.1.44" [workspace.lints.clippy] print_stdout = { level = "deny", priority = 1} diff --git a/rnex-protocols/auth-protos/Cargo.toml b/rnex-protocols/auth-protos/Cargo.toml index 74c4000..3e9bc7b 100644 --- a/rnex-protocols/auth-protos/Cargo.toml +++ b/rnex-protocols/auth-protos/Cargo.toml @@ -8,6 +8,7 @@ cfg-if = "1.0.4" ctor = "1.0.8" rnex-rmc = { path = "../../rnex-rmc" } tokio = { version = "1.52.3", features = ["time", "sync"] } +tracing = "0.1.44" [features] friends = [] diff --git a/rnex-protocols/base-protos/Cargo.toml b/rnex-protocols/base-protos/Cargo.toml index dfc9217..ef6e41c 100644 --- a/rnex-protocols/base-protos/Cargo.toml +++ b/rnex-protocols/base-protos/Cargo.toml @@ -6,6 +6,7 @@ edition = "2024" [dependencies] ctor = "1.0.8" rnex-rmc = { path = "../../rnex-rmc" } +tracing = "0.1.44" [features] splatoon = ["v3-5-0"] diff --git a/rnex-protocols/ds-protos/Cargo.toml b/rnex-protocols/ds-protos/Cargo.toml index 780b400..15f39e7 100644 --- a/rnex-protocols/ds-protos/Cargo.toml +++ b/rnex-protocols/ds-protos/Cargo.toml @@ -7,6 +7,7 @@ edition = "2024" ctor = "1.0.8" rnex-rmc = { path = "../../rnex-rmc" } rnex-base-protos = { path = "../base-protos" } +tracing = "0.1.44" [features] splatoon = ["v3-5-0"] diff --git a/rnex-protocols/fpd-protos/Cargo.toml b/rnex-protocols/fpd-protos/Cargo.toml index cbd9c67..5934e17 100644 --- a/rnex-protocols/fpd-protos/Cargo.toml +++ b/rnex-protocols/fpd-protos/Cargo.toml @@ -6,6 +6,7 @@ edition = "2024" [dependencies] ctor = "1.0.8" rnex-rmc = { path = "../../rnex-rmc" } +tracing = "0.1.44" [features] splatoon = ["v3-5-0"] diff --git a/rnex-protocols/mm-protos/Cargo.toml b/rnex-protocols/mm-protos/Cargo.toml index 36ec415..f7eeb9e 100644 --- a/rnex-protocols/mm-protos/Cargo.toml +++ b/rnex-protocols/mm-protos/Cargo.toml @@ -9,12 +9,9 @@ rnex-rmc = { path = "../../rnex-rmc" } cfg-if = "1.0.4" rnex-base-protos = { path = "../base-protos" } rnex-util = {path = "../../rnex-util"} +tracing = "0.1.44" [features] -splatoon = ["v3-5-0"] -datastore = ["database-support", "v3-8-15"] -database-support = [] -nx = [] third-notif-param = [] v3-3-2 = [] v3-4-0 = ["v3-3-2", "third-notif-param"] @@ -22,9 +19,6 @@ v3-5-0 = ["v3-4-0"] v3-8-15 = ["v3-5-0"] v3-10-22 = ["v3-8-15"] v4-3-11 = ["v3-8-15"] -friends = [] -rmc_struct_header = [] -big_pid = [] [lints] workspace = true diff --git a/rnex-protocols/msg-protos/Cargo.toml b/rnex-protocols/msg-protos/Cargo.toml index 7e88245..f5d8986 100644 --- a/rnex-protocols/msg-protos/Cargo.toml +++ b/rnex-protocols/msg-protos/Cargo.toml @@ -5,6 +5,7 @@ edition = "2024" [dependencies] ctor = "1.0.8" +tracing = "0.1.44" rnex-rmc = { path = "../../rnex-rmc" } [features] diff --git a/rnex-protocols/reggie-protos/Cargo.toml b/rnex-protocols/reggie-protos/Cargo.toml index 3370285..af606af 100644 --- a/rnex-protocols/reggie-protos/Cargo.toml +++ b/rnex-protocols/reggie-protos/Cargo.toml @@ -6,6 +6,7 @@ edition = "2024" [dependencies] ctor = "1.0.8" rnex-rmc = { path = "../../rnex-rmc" } +tracing = "0.1.44" [features] splatoon = ["v3-5-0"] diff --git a/rnex-protocols/rk-protos/Cargo.toml b/rnex-protocols/rk-protos/Cargo.toml index 0aeac6f..b6a2668 100644 --- a/rnex-protocols/rk-protos/Cargo.toml +++ b/rnex-protocols/rk-protos/Cargo.toml @@ -7,6 +7,7 @@ edition = "2024" bytemuck = { version = "1.25.0", features = ["derive"] } ctor = "1.0.8" rnex-rmc = { path = "../../rnex-rmc" } +tracing = "0.1.44" rnex-base-protos = { path = "../base-protos" } [features] diff --git a/rnex-rmc/Cargo.toml b/rnex-rmc/Cargo.toml index e9d80b4..f18dce2 100644 --- a/rnex-rmc/Cargo.toml +++ b/rnex-rmc/Cargo.toml @@ -6,7 +6,6 @@ edition = "2024" [dependencies] bytemuck = { version = "1.25.0", features = ["derive"] } thiserror = "2.0.18" -tracing = "0.1.44" v-byte-helpers = { git = "https://github.com/RusticMaple/VByteMacros", version = "0.1.1" } rnex-util = { path = "../rnex-util" } tokio = { version = "1.52.3", features = ["sync", "io-util", "rt", "macros", "time"] } @@ -15,6 +14,7 @@ rnex-rmc-macros = { path = "./macros" } paste = "1.0.15" rand = "0.10.2" hex = "0.4.3" +tracing.workspace = true [features] splatoon = ["v3-5-0"] @@ -23,7 +23,7 @@ database-support = [] nx = [] third-notif-param = [] v3-3-2 = [] -v3-4-0 = ["v3-3-2", "third-notif-param"] +v3-4-0 = ["v3-3-2", "third-notif-param", "rmc_struct_header"] v3-5-0 = ["v3-4-0"] v3-8-15 = ["v3-5-0"] v3-10-22 = ["v3-8-15"] diff --git a/rnex-rmc/macros/src/protos.rs b/rnex-rmc/macros/src/protos.rs index 671bee3..fa5fec5 100644 --- a/rnex-rmc/macros/src/protos.rs +++ b/rnex-rmc/macros/src/protos.rs @@ -223,6 +223,7 @@ impl RmcProtocolData { quote! { #[inline(always)] #attribs + #[::rnex_rmc::tracing::instrument] async fn #raw_name (&self, data: &[u8]) #optional_return{ let mut cursor = ::std::io::Cursor::new(data); #deser_params @@ -303,12 +304,12 @@ impl RmcProtocolData { quote! { #[allow(unused_must_use)] #[automatically_derived] - pub trait #raw_name: #name{ + pub trait #raw_name: #name + ::std::fmt::Debug{ #proto_raw_methods #rmc_call_proto } #[automatically_derived] - impl #raw_name for T{} + impl #raw_name for T{} } .to_token_stream() } diff --git a/rnex-rmc/src/lib.rs b/rnex-rmc/src/lib.rs index 4d034b2..f6406be 100644 --- a/rnex-rmc/src/lib.rs +++ b/rnex-rmc/src/lib.rs @@ -11,7 +11,10 @@ use std::{collections::HashMap, fmt::Debug, io::Cursor, ops::Deref, sync::Arc, t pub use rand; pub use rnex_rmc_macros::*; -use rnex_util::{SendingBufferConnection, SplittableBufferConnection, result::ResultExtension}; +use rnex_util::{ + SendingBufferConnection, SplittableBufferConnection, result::ResultExtension, + tracing::Instrument, +}; use tokio::{ sync::{Mutex, Notify}, task, @@ -322,6 +325,7 @@ impl RmcCallable for OnlyRemote { } } +#[instrument] async fn handle_incoming( sending_conn: SendingBufferConnection, remote: Arc, diff --git a/rnex-rmc/src/qresult.rs b/rnex-rmc/src/qresult.rs index bbc0757..618780f 100644 --- a/rnex-rmc/src/qresult.rs +++ b/rnex-rmc/src/qresult.rs @@ -10,7 +10,7 @@ pub const ERROR_MASK: u32 = 1 << 31; #[derive(Pod, Zeroable, Copy, Clone, Debug)] #[repr(transparent)] -pub struct QResult(u32); +pub struct QResult(pub u32); impl QResult { pub fn success(error_code: ErrorCode) -> Self { diff --git a/rnex-rmc/src/serialization.rs b/rnex-rmc/src/serialization.rs index ee3ce15..a15be3a 100644 --- a/rnex-rmc/src/serialization.rs +++ b/rnex-rmc/src/serialization.rs @@ -1,5 +1,5 @@ use std::{ - fmt, + fmt::{self, Debug}, io::{self, Read, Write}, string::FromUtf8Error, }; diff --git a/rnex-rmc/src/string_set.rs b/rnex-rmc/src/string_set.rs index 7f71da5..6b357c5 100644 --- a/rnex-rmc/src/string_set.rs +++ b/rnex-rmc/src/string_set.rs @@ -1,5 +1,6 @@ use std::{ collections::HashSet, + fmt::Debug, hash::Hash, io::{Read, Write}, str::FromStr, @@ -9,11 +10,11 @@ use std::{ use crate::serialization::{Error, Result, RmcSerialize}; #[derive(Debug, Clone)] -pub struct StringSet(pub HashSet) +pub struct StringSet(pub HashSet) where ::Err: std::error::Error + Send + Sync + 'static; -impl PartialEq for StringSet +impl PartialEq for StringSet where ::Err: std::error::Error + Send + Sync + 'static, { @@ -22,7 +23,7 @@ where } } -impl ToString for StringSet +impl ToString for StringSet where ::Err: std::error::Error + Send + Sync + 'static, { @@ -35,7 +36,7 @@ where } } -impl FromStr for StringSet +impl FromStr for StringSet where ::Err: std::error::Error + Send + Sync + 'static, { @@ -57,7 +58,7 @@ where } } -impl RmcSerialize for StringSet +impl RmcSerialize for StringSet where ::Err: std::error::Error + Send + Sync + 'static, { diff --git a/rnex-server-nex-modules/rnex-auth/src/auth_handler.rs b/rnex-server-nex-modules/rnex-auth/src/auth_handler.rs index 9f842c9..f32ed75 100644 --- a/rnex-server-nex-modules/rnex-auth/src/auth_handler.rs +++ b/rnex-server-nex-modules/rnex-auth/src/auth_handler.rs @@ -1,20 +1,17 @@ use std::{ hash::{DefaultHasher, Hasher}, net::SocketAddrV4, - sync::{LazyLock}, + sync::LazyLock, }; use cfg_if::cfg_if; -use nex_account::{ - grpc, - grpc_client, -}; +use nex_account::{grpc, grpc_client}; use rnex_auth_protos::{ LocalAuthProtocol, auth::{Auth, ConnectionData, ConnectionDataOld}, }; use rnex_prudp::kerberos::{Ticket, TicketInternalData}; -use rnex_reggie_protos::reggie::{RemoteEdgeNodeManagement}; +use rnex_reggie_protos::reggie::RemoteEdgeNodeManagement; use rnex_rmc::{ any::Any, qresult::QResult, @@ -350,3 +347,46 @@ impl Auth for AuthHandler { Err(ErrorCode::Core_Exception) } } +#[cfg(test)] +mod test { + use std::io::Cursor; + + use rnex_auth_protos::auth::ConnectionData; + use rnex_rmc::{ + qresult::QResult, + serialization::RmcSerialize, + util::{PID, date_time::DateTime}, + }; + + type A = (QResult, PID, Vec, ConnectionData, String); + + #[test] + fn test() { + let data: Vec = vec![ + 117, 78, 111, 185, 170, 86, 1, 87, 12, 184, 207, 248, 138, 244, 200, 253, 115, 80, 239, + 214, 101, 196, 158, 106, 17, 107, 196, 210, 174, 2, 57, 126, 192, 37, 185, 250, 1, 237, + 21, 26, 95, 138, 247, 179, 204, 145, 61, 62, 68, 192, 16, 57, 73, 59, 123, 29, 219, + 181, 235, 252, 19, 241, 47, 54, 215, 231, 0, 42, 20, 15, 139, 27, 135, 88, 25, 193, + 172, 242, 13, 244, 128, 118, 37, 244, 102, 138, 8, 40, 182, 242, 146, 92, 104, 53, 4, + 52, 212, 47, 145, 120, 8, 78, 127, 150, 29, 210, 68, 203, 36, 241, 96, 189, 18, 153, + 109, 121, + ]; + let data: A = ( + QResult(65537), + 1132, + data, + ConnectionData { + station_url: + "prudps:/PID=2;sid=1;stream=10;type=2;address=45.85.147.85;port=17001;CID=1" + .into(), + special_protocols: [].into(), + special_station_url: "".into(), + date_time: DateTime(135993837066), + }, + "branch:origin/project/wup-agmj build:3_8_15_2004_0".to_owned(), + ); + + let test = data.to_data().unwrap(); + A::deserialize(&mut Cursor::new(&test[..])).unwrap(); + } +} diff --git a/rnex-server-nex-modules/rnex-ds/src/datastore.rs b/rnex-server-nex-modules/rnex-ds/src/datastore.rs index 3978833..ed71842 100644 --- a/rnex-server-nex-modules/rnex-ds/src/datastore.rs +++ b/rnex-server-nex-modules/rnex-ds/src/datastore.rs @@ -391,6 +391,7 @@ impl DatastoreUser { ErrorCode::DataStore_NotFound })?; info!("done running"); + Ok(()) } // Dawg... diff --git a/rnex-server-nex-modules/rnex-msg/src/lib.rs b/rnex-server-nex-modules/rnex-msg/src/lib.rs index 96ecd68..9a5d2f5 100644 --- a/rnex-server-nex-modules/rnex-msg/src/lib.rs +++ b/rnex-server-nex-modules/rnex-msg/src/lib.rs @@ -9,6 +9,7 @@ use crate::user::MessagingUser; pub mod user; +#[derive(Debug)] pub struct MessagingManager { users_by_pid: RwLock>>, } diff --git a/rnex-server-nex-modules/rnex-msg/src/user.rs b/rnex-server-nex-modules/rnex-msg/src/user.rs index 5825904..7e49717 100644 --- a/rnex-server-nex-modules/rnex-msg/src/user.rs +++ b/rnex-server-nex-modules/rnex-msg/src/user.rs @@ -7,6 +7,7 @@ use rnex_msg_protos::{ use rnex_rmc::{any::Any, response::ErrorCode, rmc_struct, util::PID}; use rnex_server::{PassthroughInitModule, WeakPassthroughInitModule}; +#[derive(Debug)] #[rmc_struct(MessagingProtocol)] pub struct MessagingUser { pub msgm: PassthroughInitModule,