pub struct SessionManager { /* private fields */ }Expand description
Thread-safe registry of active sessions.
Backed by parking_lot::RwLock for fast concurrent reads. Session
lookups happen on every RTP delivery cycle, so read performance matters.
Implementations§
Source§impl SessionManager
impl SessionManager
pub fn new() -> Self
Sourcepub fn create_session(&self, uri: &str) -> Arc<Session>
pub fn create_session(&self, uri: &str) -> Arc<Session>
Create a new session for the given URI and register it.
Sourcepub fn remove_session(&self, id: &str) -> Option<Arc<Session>>
pub fn remove_session(&self, id: &str) -> Option<Arc<Session>>
Remove and return a session by ID (used by TEARDOWN).
Sourcepub fn remove_sessions(&self, ids: &[String]) -> usize
pub fn remove_sessions(&self, ids: &[String]) -> usize
Remove multiple sessions at once (used during TCP disconnect cleanup).
Sourcepub fn allocate_server_ports(&self) -> Result<(u16, u16)>
pub fn allocate_server_ports(&self) -> Result<(u16, u16)>
Allocate a pair of (RTP, RTCP) server ports.
Ports are allocated from a monotonic counter starting at 5000. When the range is exhausted (> 65534), it wraps back to 5000. Per RFC 3550 §11, RTP ports should be even and RTCP = RTP + 1.
Sourcepub fn get_playing_sessions(&self) -> Vec<Arc<Session>>
pub fn get_playing_sessions(&self) -> Vec<Arc<Session>>
Returns all sessions currently in the SessionState::Playing state.
Trait Implementations§
Source§impl Clone for SessionManager
impl Clone for SessionManager
Source§fn clone(&self) -> SessionManager
fn clone(&self) -> SessionManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionManager
impl !RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
impl !UnwindSafe for SessionManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more