mirror of https://github.com/chipsenkbeil/distant
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.
24 lines
522 B
Rust
24 lines
522 B
Rust
2 years ago
|
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()
|
||
|
}
|
||
|
}
|