Compare commits

...

2 commits
v1.0.0 ... main

Author SHA1 Message Date
1a1e56aef0
whoops the fix made your user duplicate 2025-03-04 16:46:38 -06:00
c77a44f596
maybe fix bug with rejoining 2025-03-04 16:43:36 -06:00

View file

@ -119,14 +119,6 @@ fn handle_client(mut stream: TcpStream, channel: Channel) {
if user.token != String::from_utf8_lossy(&(buf[..i])) {
break 'bufreadloop2;
}
let mut i = 0usize;
for user in &channel.lock().unwrap().online_users {
if user.name == new_name {
channel.lock().unwrap().online_users.swap_remove(i);
break;
}
i += 1;
}
break 'bufreadloop;
}
if i < 50 {
@ -180,7 +172,19 @@ fn handle_client(mut stream: TcpStream, channel: Channel) {
token: "".to_owned(),
};
let mut broke = false;
for usr in &mut channel.lock().unwrap().online_users {
if usr.name == user.name {
usr.status = user.status.clone();
usr.token = user.token.clone();
broke = true;
break;
}
}
if !broke {
channel.lock().unwrap().online_users.push(user.clone());
}
let (recieve_terminate_send, recieve_terminate_recv) = std::sync::mpsc::channel::<()>();
let recieve_thread: JoinHandle<_>;