Introduce client-side timeout when trying to connect

This commit is contained in:
Antonio Scandurra 2022-10-12 15:11:07 +02:00
parent a19783919c
commit cc56fa9ea6
2 changed files with 112 additions and 29 deletions

View file

@ -101,10 +101,12 @@ impl FakeServer {
}
pub fn disconnect(&self) {
self.peer.disconnect(self.connection_id());
let mut state = self.state.lock();
state.connection_id.take();
state.incoming.take();
if self.state.lock().connection_id.is_some() {
self.peer.disconnect(self.connection_id());
let mut state = self.state.lock();
state.connection_id.take();
state.incoming.take();
}
}
pub fn auth_count(&self) -> usize {