pub trait RTSPSessionPoolExt:
IsA<RTSPSessionPool>
+ Sealed
+ 'static {
// Provided methods
fn cleanup(&self) -> u32 { ... }
fn create(&self) -> Result<RTSPSession, BoolError> { ... }
fn filter(
&self,
func: Option<&mut dyn FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult>,
) -> Vec<RTSPSession> { ... }
fn find(&self, sessionid: &str) -> Option<RTSPSession> { ... }
fn max_sessions(&self) -> u32 { ... }
fn n_sessions(&self) -> u32 { ... }
fn remove(&self, sess: &impl IsA<RTSPSession>) -> Result<(), BoolError> { ... }
fn set_max_sessions(&self, max: u32) { ... }
fn connect_session_removed<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_max_sessions_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn cleanup(&self) -> u32
fn cleanup(&self) -> u32
Inspect all the sessions in self
and remove the sessions that are inactive
for more than their timeout.
§Returns
the amount of sessions that got removed.
sourcefn create(&self) -> Result<RTSPSession, BoolError>
fn create(&self) -> Result<RTSPSession, BoolError>
sourcefn filter(
&self,
func: Option<&mut dyn FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult>,
) -> Vec<RTSPSession>
fn filter( &self, func: Option<&mut dyn FnMut(&RTSPSessionPool, &RTSPSession) -> RTSPFilterResult>, ) -> Vec<RTSPSession>
Call func
for each session in self
. The result value of func
determines
what happens to the session. func
will be called with the session pool
locked so no further actions on self
can be performed from func
.
If func
returns RTSPFilterResult::Remove
, the session will be set to the
expired state and removed from self
.
If func
returns RTSPFilterResult::Keep
, the session will remain in self
.
If func
returns RTSPFilterResult::Ref
, the session will remain in self
but
will also be added with an additional ref to the result GList of this
function..
When func
is None
, RTSPFilterResult::Ref
will be assumed for all sessions.
§func
a callback
§Returns
a GList with all
sessions for which func
returned RTSPFilterResult::Ref
. After usage, each
element in the GList should be unreffed before the list is freed.
sourcefn find(&self, sessionid: &str) -> Option<RTSPSession>
fn find(&self, sessionid: &str) -> Option<RTSPSession>
Find the session with sessionid
in self
. The access time of the session
will be updated with RTSPSessionExt::touch()
.
§sessionid
the session id
§Returns
the RTSPSession
with sessionid
or None
when the session did not exist. g_object_unref()
after usage.
sourcefn max_sessions(&self) -> u32
fn max_sessions(&self) -> u32
Get the maximum allowed number of sessions in self
. 0 means an unlimited
amount of sessions.
§Returns
the maximum allowed number of sessions.
sourcefn n_sessions(&self) -> u32
fn n_sessions(&self) -> u32
sourcefn remove(&self, sess: &impl IsA<RTSPSession>) -> Result<(), BoolError>
fn remove(&self, sess: &impl IsA<RTSPSession>) -> Result<(), BoolError>
sourcefn set_max_sessions(&self, max: u32)
fn set_max_sessions(&self, max: u32)
Configure the maximum allowed number of sessions in self
to max
.
A value of 0 means an unlimited amount of sessions.
§max
the maximum number of sessions