aquatic_udp: move ConnectionKey and ConnectionMap to network.rs

This commit is contained in:
Joakim Frostegård 2021-10-18 01:27:16 +02:00
parent de85feec9a
commit e2be31c7de
2 changed files with 19 additions and 18 deletions

View file

@ -1,5 +1,5 @@
use std::hash::Hash;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use std::sync::{atomic::AtomicUsize, Arc};
use std::time::Instant;
@ -49,23 +49,6 @@ impl Into<Response> for ConnectedResponse {
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ConnectionKey {
pub connection_id: ConnectionId,
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)]
pub enum PeerStatus {
Seeding,