From 1a25e882f30a7f4a8af5c0942c82fcce4396121b Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Sun, 27 Jul 2025 22:45:44 +0200 Subject: [PATCH] misc changes --- src/client/net.rs | 2 ++ src/lib.rs | 11 ++++++++++- src/server/types.rs | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/client/net.rs b/src/client/net.rs index 3ee5b1f..f9a0a5f 100644 --- a/src/client/net.rs +++ b/src/client/net.rs @@ -142,3 +142,5 @@ pub fn register_request( Err(e) => return Err(e), } } + +fn get_request() -> Result {} diff --git a/src/lib.rs b/src/lib.rs index 9753107..d2f0216 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ pub enum ServerMethods { QUERY = 0, // return IP and port of the client REGISTER = 1, GET = 2, - HEARTBEAT = 3, + HEARTBEAT = 3, // this also registers addtional clients } #[allow(non_camel_case_types)] pub enum ServerResponse { @@ -24,6 +24,7 @@ pub enum ServerResponse { #[allow(non_camel_case_types)] #[derive(Debug)] pub enum ServerErrorResponses { + // success server returns id of method GENERAL_ERROR(String), ID_EXISTS, ID_DOESNT_EXIST, @@ -75,4 +76,12 @@ pub enum GetResponseDataPositions { // after this there will be blocks of this sturcture: one byte size of sockaddr than there will be IV that is SALT_AND_IV_SIZE long and after that there will be sockaddr this repeats until the end of packet } +#[allow(non_camel_case_types)] +pub enum HeartBeatRequestDataPositions { + ID_LEN = 1, + SOCKADDR_LEN = 2, + IV = 3, + DATA = (HeartBeatRequestDataPositions::IV as u8 + SALT_AND_IV_SIZE) as isize, // first ID than sockaddr +} + pub mod shared; diff --git a/src/server/types.rs b/src/server/types.rs index 15784fa..d6ed335 100644 --- a/src/server/types.rs +++ b/src/server/types.rs @@ -1,4 +1,5 @@ use pea_2_pea::*; +use std::ops::{Deref, DerefMut}; use std::sync::{Arc, atomic::Ordering}; #[derive(Clone)] @@ -25,7 +26,6 @@ impl Client { pub struct Registration { #[readonly] pub net_id: String, - #[readonly] pub clients: Vec, pub last_heart_beat: i64,