misc changes
This commit is contained in:
parent
0095606b60
commit
1a25e882f3
@ -142,3 +142,5 @@ pub fn register_request(
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_request() -> Result<usize, ServerErrorResponses> {}
|
||||
|
11
src/lib.rs
11
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;
|
||||
|
@ -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<Client>,
|
||||
|
||||
pub last_heart_beat: i64,
|
||||
|
Loading…
x
Reference in New Issue
Block a user