You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
distant/distant-net/src/server/state.rs

24 lines
522 B
Rust

use crate::{ConnectionId, ServerConnection};
use std::collections::HashMap;
use tokio::sync::RwLock;
/// Contains all top-level state for the server
pub struct ServerState {
/// Mapping of connection ids to their transports
pub connections: RwLock<HashMap<ConnectionId, ServerConnection>>,
}
impl ServerState {
pub fn new() -> Self {
Self {
connections: RwLock::new(HashMap::new()),
}
}
}
impl Default for ServerState {
fn default() -> Self {
Self::new()
}
}