remoted unused

This commit is contained in:
Dominik Maier 2020-12-09 00:48:25 +01:00
parent 5fdbd5439e
commit 06fbdf2564

View File

@ -11,53 +11,6 @@ use super::{
Event, EventManager, Event, EventManager,
}; };
pub unsafe fn llmp_tcp_server_clientloop(client: *mut LlmpClient, _data: *mut c_void) -> ! {
// Later in the execution, after the initial map filled up,
// the current broacast map will will point to a different map.
// However, the original map is (as of now) never freed, new clients will start
// to read from the initial map id.
let initial_broadcasts_map_str = client
.as_ref()
.unwrap()
.current_broadcast_map
.as_ref()
.unwrap()
.shm_str;
let listener = TcpListener::bind("0.0.0.0:3333").unwrap();
// accept connections and process them, spawning a new thread for each one
println!("Server listening on port 3333");
loop {
let (mut stream, addr) = match listener.accept() {
Ok(res) => res,
Err(e) => {
dbg!("Ignoring failed accept", e);
continue;
}
};
dbg!("New connection", addr, stream.peer_addr().unwrap());
match stream.write(&initial_broadcasts_map_str as &[u8]) {
Ok(_) => {} // fire & forget
Err(e) => {
dbg!("Could not send to shmap to client", e);
continue;
}
};
let mut new_client_map_str: [u8; 20] = Default::default();
let map_str_len = match stream.read(&mut new_client_map_str) {
Ok(res) => res,
Err(e) => {
dbg!("Ignoring failed read from client", e);
continue;
}
};
if map_str_len < 20 {
dbg!("Didn't receive a complete shmap id str from client. Ignoring.");
continue;
}
}
}
/// Eventmanager for multi-processed application /// Eventmanager for multi-processed application
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub struct LLMPEventManager<C, E, I, R> pub struct LLMPEventManager<C, E, I, R>