@@ -46,9 +46,14 @@ impl ConnectionPool{ | |||
pub fn broadcast(&self, sender_iid: &u32, msg: &String) { | |||
let mut del_conns: Vec<u32> = Vec::new(); | |||
let mut msg1: String; | |||
msg1 = format!("User {sender_iid}: ").parse().unwrap(); | |||
msg1.push_str(msg); | |||
for (iid, mut conn) in self.conns.lock().unwrap().iter() { | |||
if sender_iid.ne(iid){ | |||
if conn.write_all(msg.as_bytes()).is_err() { | |||
if conn.write_all(msg1.as_bytes()).is_err() { | |||
del_conns.push(*iid); | |||
continue; | |||
} |