Check whether connection is still active upon mio event

Fix issue #3
This commit is contained in:
B. Blechschmidt 2022-12-10 21:29:57 +01:00
parent 41c22fa4d4
commit be3d7e314b

View file

@ -439,8 +439,8 @@ impl<'a> TunToProxy<'a> {
}
fn mio_socket_event(&mut self, event: &Event) {
let connection = *self.token_to_connection.get(&event.token()).unwrap();
if let Some(conn_ref) = self.token_to_connection.get(&event.token()) {
let connection = *conn_ref;
if event.is_readable() {
{
let state = self.connections.get_mut(&connection).unwrap();
@ -496,6 +496,7 @@ impl<'a> TunToProxy<'a> {
self.write_to_server(&connection);
}
}
}
fn udp_event(&mut self, _event: &Event) {}