This commit is contained in:
2025-10-18 11:00:04 -05:00
parent 7128377924
commit 09e05c9f8e

View File

@@ -78,7 +78,6 @@ async fn websocket(socket: WebSocket, state: Arc<AppState>) {
let mut rx = state.tx.subscribe(); let mut rx = state.tx.subscribe();
let _ = state.tx.send(format!("{username} joined the lobby!")); let _ = state.tx.send(format!("{username} joined the lobby!"));
// Read messages broadcast through the server, write them to this socket. // Read messages broadcast through the server, write them to this socket.
// If any error is returned, break the loop to terminate the task. We're // If any error is returned, break the loop to terminate the task. We're
// not dealing with them right now. // not dealing with them right now.
@@ -122,7 +121,7 @@ async fn websocket(socket: WebSocket, state: Arc<AppState>) {
fn check_username(state: &AppState, name_out: &mut String, name: &str) { fn check_username(state: &AppState, name_out: &mut String, name: &str) {
// TODO: Return a Result instead of using out-parameters. This isn't C, // TODO: Return a Result instead of using out-parameters. This isn't C,
// we can do better. // we can do better.
let mut user_set= state.user_set.lock().unwrap(); let mut user_set = state.user_set.lock().unwrap();
if !user_set.contains(name) { if !user_set.contains(name) {
user_set.insert(name.to_owned()); user_set.insert(name.to_owned());
name_out.push_str(name); name_out.push_str(name);