From 3a03ceb8ceeed1927e23d707ad2fea658ef75820 Mon Sep 17 00:00:00 2001 From: Kyle Johnsen Date: Sat, 12 Mar 2022 21:54:52 -0500 Subject: [PATCH] fixed another unwrap bug --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 010c030..5bbca05 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,6 +121,14 @@ async fn process_client(socket: TcpStream, udp_socket: Rc>, c let client_notify = Rc::new(Notify::new()); let client_notify_udp = Rc::new(Notify::new()); + + let ip; + + match socket.peer_addr() { + Ok(p)=>ip=p.ip(), + Err(e)=>{return;} + } + let client = Rc::new(RefCell::new(Client{ id: my_id, username: String::from(""), @@ -128,7 +136,7 @@ async fn process_client(socket: TcpStream, udp_socket: Rc>, c roomname: String::from(""), application: String::from(""), groups: HashMap::new(), - ip: socket.peer_addr().unwrap().ip(), + ip: ip, udp_port: 0 as u16, message_queue: vec![], message_queue_udp: vec![],