fix(event loop): don't try to get client every time in loop
This commit is contained in:
@@ -61,18 +61,24 @@ impl EventLoop {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
STOP => return Ok(()),
|
STOP => return Ok(()),
|
||||||
token => loop {
|
token => {
|
||||||
match clients.get(token.0).unwrap().as_ref().unwrap().dispatch() {
|
let client =
|
||||||
Ok(_) => continue,
|
clients.get(token.0).and_then(|client| client.as_ref());
|
||||||
Err(e) => match e.kind() {
|
if let Some(client) = client {
|
||||||
std::io::ErrorKind::WouldBlock => break,
|
loop {
|
||||||
_ => {
|
match client.dispatch() {
|
||||||
clients.remove(token.0);
|
Ok(_) => continue,
|
||||||
break;
|
Err(e) => match e.kind() {
|
||||||
|
std::io::ErrorKind::WouldBlock => break,
|
||||||
|
_ => {
|
||||||
|
clients.remove(token.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user