Trait s2n_quic_core::path::Handle
source · pub trait Handle: 'static + Copy + Send + Debug {
// Required methods
fn from_remote_address(remote_addr: RemoteAddress) -> Self;
fn remote_address(&self) -> RemoteAddress;
fn set_remote_port(&mut self, port: u16);
fn local_address(&self) -> LocalAddress;
fn eq(&self, other: &Self) -> bool;
fn strict_eq(&self, other: &Self) -> bool;
fn maybe_update(&mut self, other: &Self);
}Expand description
An interface for an object that represents a unique path between two endpoints
Required Methods§
sourcefn from_remote_address(remote_addr: RemoteAddress) -> Self
fn from_remote_address(remote_addr: RemoteAddress) -> Self
Creates a Handle from a RemoteAddress
sourcefn remote_address(&self) -> RemoteAddress
fn remote_address(&self) -> RemoteAddress
Returns the remote address for the given handle
sourcefn set_remote_port(&mut self, port: u16)
fn set_remote_port(&mut self, port: u16)
Updates the remote port to the given value
sourcefn local_address(&self) -> LocalAddress
fn local_address(&self) -> LocalAddress
Returns the local address for the given handle
sourcefn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Returns true if the two handles are equal from a network perspective
This function is used to determine if a connection has migrated to another path.
sourcefn strict_eq(&self, other: &Self) -> bool
fn strict_eq(&self, other: &Self) -> bool
Returns true if the two handles are strictly equal to each other, i.e.
byte-for-byte.
sourcefn maybe_update(&mut self, other: &Self)
fn maybe_update(&mut self, other: &Self)
Depending on the current value of self, fields from other may be copied to increase the
fidelity of the value.
This is especially useful for clients that initiate a connection only based on the remote IP and port. They likely wouldn’t know the IP address of the local socket. Once a response is received from the server, the IP information will be known at this point and the handle can be updated with the new information.
Implementations should try to limit the cost of updating by checking the current value to see if it needs updating.