pub struct SessionRegistry { /* private fields */ }Expand description
Registry of live full-mode device sessions for periodic revalidation.
Clone is cheap (Arc); all clones share the same map.
Implementations§
Source§impl SessionRegistry
impl SessionRegistry
Sourcepub fn contains(&self, device_id: &str) -> bool
pub fn contains(&self, device_id: &str) -> bool
Whether device_id currently has a live session.
Sourcepub fn insert(
&self,
device_id: String,
credential: String,
endpoint_hex: String,
close: SessionClose,
) -> u64
pub fn insert( &self, device_id: String, credential: String, endpoint_hex: String, close: SessionClose, ) -> u64
Register a newly opened full-mode session.
If device_id already has a session, the previous one is closed with
SUPERSEDED_CLOSE_CODE. Returns the new session id.
Sourcepub fn remove_if(&self, device_id: &str, session_id: u64) -> bool
pub fn remove_if(&self, device_id: &str, session_id: u64) -> bool
Remove the session only if session_id is still the live one for device_id.
Sourcepub fn close(
&self,
device_id: &str,
session_id: u64,
reason: &'static [u8],
) -> bool
pub fn close( &self, device_id: &str, session_id: u64, reason: &'static [u8], ) -> bool
Close and remove the matching live session (revocation / expiry).
Sourcepub fn bind_webrtc(&self, device_id: &str, handle: WebRtcHandle) -> bool
pub fn bind_webrtc(&self, device_id: &str, handle: WebRtcHandle) -> bool
Bind a WebRTC answerer handle into the live session for device_id.
Returns false (and closes handle) when no session is registered.
A later bind replaces the previous handle and closes it.
Source§impl SessionRegistry
impl SessionRegistry
Sourcepub async fn revalidate(&self, bus: &dyn HostBus) -> RevalidateReport
pub async fn revalidate(&self, bus: &dyn HostBus) -> RevalidateReport
Re-verify every live session via HostBus::verify.
Closes a session only on a definitive refusal code
(device_revoked, expired, invalid_credential, endpoint_mismatch).
verifier_unavailable, timeouts and other errors leave it open and
increment RevalidateReport::skipped.