user iid added to broadcast msg
This commit is contained in:
parent
2ec1342d91
commit
352c6ecffd
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user