diff --git a/ws_server/src/main.rs b/ws_server/src/main.rs index 7e359ef..00a5c47 100644 --- a/ws_server/src/main.rs +++ b/ws_server/src/main.rs @@ -8,12 +8,14 @@ use std::thread; use ws_core::read::read_header; use ws_core::write::send_server_message; - -pub fn handle_client(mut stream: TcpStream, clients: Arc>>) -> Result<()> { +pub fn handle_client( + mut stream: TcpStream, + clients: Arc>>, +) -> Result<()> { { let mut list = clients.lock().unwrap(); let id = stream.peer_addr().unwrap().port() as usize; - list.push((id,stream.try_clone()?)); + list.push((id, String::new(), stream.try_clone()?)); } // these variable are here to read all the buffer sent from the client let mut buffer = Vec::new(); @@ -82,6 +84,7 @@ pub fn handle_client(mut stream: TcpStream, clients: Arc>() }; @@ -131,27 +151,28 @@ pub fn handle_client(mut stream: TcpStream, clients: Arc Result<()> { Ok(()) } -fn remove_client (id:usize,clients: &Arc>>) { +fn remove_client(id: usize, clients: &Arc>>) { let mut list = clients.lock().unwrap(); - list.retain(|(cid, _)| *cid != id); -} \ No newline at end of file + list.retain(|(cid, _, _)| *cid != id); +}