[−][src]Struct libccp::Connection
An individual Connection.
Connections cannot outlive the Datapath
they belong to, since they contain
a pointer to memory that is freed when Datapath
is dropped.
So, their lifetime is 'dp
from the &'dp Datapath
.
You can regain access to the impl CongestionOps
by dereferencing Connection
struct Dp(); impl libccp::DatapathOps for Dp { fn send_msg(&mut self, _: &[u8]) { /* ___ */ } } struct Cn(u32); impl libccp::CongestionOps for Cn { fn set_cwnd(&mut self, cwnd: u32) { /* ___ */ } fn set_rate_abs(&mut self, cwnd: u32) { /* ___ */ } } fn main() { let d = libccp::Datapath::init(Dp()).unwrap(); let mut c = libccp::Connection::start(&d, Cn(0), libccp::FlowInfo::default()).unwrap(); c.load_primitives(libccp::Primitives::default()); c.0 = 1; }
Methods
impl<'dp, T: CongestionOps + 'static> Connection<'dp, T>
[src]
pub fn start(
token: &'dp Datapath,
conn: T,
flow_info: FlowInfo
) -> Result<Self, Error>
[src]
token: &'dp Datapath,
conn: T,
flow_info: FlowInfo
) -> Result<Self, Error>
Call this function when a connection starts.
conn: impl CongestionOps
represents per-connection state,
and how to mutate it in response to changing congestion windows
or rates.
pub fn load_primitives(&mut self, prims: Primitives)
[src]
Inform libccp of new measurements.
pub fn primitives(&self, _token: &Datapath) -> Primitives
[src]
pub fn invoke(&mut self) -> Result<(), Error>
[src]
Tell libccp to invoke. This will run the congestion control's datapath program,
and potentially result in calls to the CongestionOps
callbacks.
Therefore, ensure that when you call this function, you are not holding locks that
the CongestionOps
functionality tries to acquire - this will deadlock.
Trait Implementations
impl<'dp, T: CongestionOps> Send for Connection<'dp, T>
[src]
impl<'dp, T: CongestionOps> Drop for Connection<'dp, T>
[src]
impl<'dp, T: CongestionOps> DerefMut for Connection<'dp, T>
[src]
impl<'dp, T: CongestionOps> Deref for Connection<'dp, T>
[src]
Auto Trait Implementations
impl<'dp, T> !Sync for Connection<'dp, T>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,