Skip to content

Commit

Permalink
lesson 13
Browse files Browse the repository at this point in the history
  • Loading branch information
alembiq committed Jun 26, 2024
1 parent 54d9f61 commit 5d3bef5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lesson13/server13/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ fn listen_and_accept(address: String) -> Result<()> {
let clients_clone = clients.clone();

thread::spawn(move || loop {
let mut clients_lock = clients_clone.lock();
let mut peers_to_remove = vec![];
let message = match incoming_message(&mut stream) {
Ok(msg) => msg,
Err(e) => {
Expand All @@ -49,6 +47,8 @@ fn listen_and_accept(address: String) -> Result<()> {
};

// message other clients
let mut clients_lock = clients_clone.lock();
let mut peers_to_remove = vec![];
for (peer_addr, peer_stream) in clients_lock.iter_mut() {
if *peer_addr == addr {
continue;
Expand Down

0 comments on commit 5d3bef5

Please sign in to comment.