aquatic_udp: improve code for request connection validity checks

This commit is contained in:
Joakim Frostegård 2021-10-15 23:59:16 +02:00
parent 03c36f51c9
commit 881579435a
2 changed files with 34 additions and 30 deletions

View file

@ -36,6 +36,15 @@ pub struct ConnectionKey {
pub socket_addr: SocketAddr,
}
impl ConnectionKey {
pub fn new(connection_id: ConnectionId, socket_addr: SocketAddr) -> Self {
Self {
connection_id,
socket_addr,
}
}
}
pub type ConnectionMap = HashMap<ConnectionKey, ValidUntil>;
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]