pub struct Serving<S> { /* private fields */ }Expand description
A serving loop on a background task: the SDKs’ tunnel and port-forward handles.
Dropping it stops the loop and cuts the connections still open, so no relay outlives the handle that owns it: a relay carries the VM’s credentials to whoever connected.
Implementations§
Source§impl<S> Serving<S>
impl<S> Serving<S>
Sourcepub fn local_address(&self) -> SocketAddr
pub fn local_address(&self) -> SocketAddr
The address the loop listens on, with the port the OS picked for a port 0.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether the loop is still serving, or waiting for its open connections to end.
Sourcepub fn request_stop(&self)
pub fn request_stop(&self)
Asks the loop to stop accepting. Idempotent; Self::finished waits for it, and for the
connections still open.
Sourcepub async fn stop(&self, grace: Option<Duration>) -> Result<S, Error>
pub async fn stop(&self, grace: Option<Duration>) -> Result<S, Error>
Stops accepting and waits for the connections still open to end, cutting the ones
still open after grace when it’s given, and returns what the loop did.
Without a grace, a client that keeps its connection open keeps this waiting: the relay holds bytes that client may still be reading, so the loop won’t cut it unasked.
Auto Trait Implementations§
impl<S> !Freeze for Serving<S>
impl<S> RefUnwindSafe for Serving<S>
impl<S> Send for Serving<S>
impl<S> Sync for Serving<S>
impl<S> Unpin for Serving<S>
impl<S> UnsafeUnpin for Serving<S>
impl<S> UnwindSafe for Serving<S>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more