Skip to main content

Output

Struct Output 

Source
pub(super) struct Output {
    transport: Transport,
    failed: bool,
    peer_closed: Arc<AtomicBool>,
    too_large: bool,
    ending: Option<Instant>,
    idle_timeout: Option<Duration>,
}
Expand description

The sending half of a session. A failing send means that the client went away, which ends the session. After a clean close of a WebSocket client, sends fail as well, the output gets dropped then. The session still forwards the stdin which the client sent before its close to the process and reads the output meanwhile, so that the process does not wait for it. A SPDY connection which ends after the client closed its stdin counts as a clean close.

Fields§

§transport: Transport§failed: bool§peer_closed: Arc<AtomicBool>

Set once the client closed the connection cleanly.

§too_large: bool

Whether a WebSocket gets closed for a message of the client which was too large.

§ending: Option<Instant>

When the end of the session started, the status and the close share the STALL_TIMEOUT from then on, a client which takes nothing does not get it twice.

§idle_timeout: Option<Duration>

The idle timeout of the session, which its end waits for as well: a client which takes nothing, like one which pauses a pager, keeps the end until it took nothing for the idle timeout, at least for the STALL_TIMEOUT, see Activity::until_stalled_or_idle. Without one, the end waits for the STALL_TIMEOUT only. A client which vanished without a reset while its output backs up holds the end as long as well, or until the kernel gives up resending to it, 15 to 30 minutes with the default tcp_retries2 of 15: there is no keepalive, and nothing waits for the echoes of pings. None once the session failed for a message of the client which was too large, see Self::close_too_large.

Implementations§

Source§

impl Output

Source

pub(super) fn websocket( sender: SplitSink<WebSocketStream<ClientIo<TokioIo<Upgraded>>>, Message>, framing: Framing, activity: Activity, written: Activity, idle_timeout: Option<Duration>, ) -> Self

The output of a WebSocket session, whose end waits for the idle_timeout of the session as well, see Self::idle_timeout.

Source

pub(super) fn spdy(output: SpdyOutput, idle_timeout: Option<Duration>) -> Self

The output of a SPDY session, which shares whether the client closed its stdin with its input, see SpdyInput, and whose end waits for the idle_timeout of the session as well, see Self::idle_timeout.

Source

fn new( transport: Transport, peer_closed: Arc<AtomicBool>, idle_timeout: Option<Duration>, ) -> Self

Source

pub(super) fn close_too_large(&mut self)

Close a WebSocket with the code for a message of the client which was too large, which tells the client why the session failed. The session failed, its status and its close do not wait for the idle timeout, only for the STALL_TIMEOUT.

Source

pub(super) fn peer_closed(&self) -> Arc<AtomicBool> ⓘ

Set by the input once the client closed the connection cleanly.

Source

pub(super) async fn announce( &mut self, stdout: bool, stderr: bool, ) -> Result<()>

Tell a WebSocket client before v5 that the session started, with an empty message on the first channel it gets output on.

Source

pub(super) async fn data(&mut self, pipe: Pipe, data: &Bytes) -> Result<()>

Send output of the pipe of the process.

Source

pub(super) async fn status(&mut self, status: &Status) -> Result<()>

Send the final status of the session. Over SPDY it waits behind the output queued before, a slow client gets it all the same, one which stopped reading for STALL_TIMEOUT does not get it, see Self::idle_timeout.

Source

fn ending(&mut self) -> Instant

When the end of the session started, the first time this got called.

Source

fn written(&self) -> Activity

Touched whenever a part of what the server sends went out.

Source

async fn send_status(&mut self, status: &Status) -> Result<()>

Source

pub(super) async fn ping(&mut self) -> Result<()>

Check that the client is still there while the session waits. A ping to a client which went away fails. A SPDY connection pings the client itself, also when it is not read while stdin waits for the process, and ends once a write fails.

Source

pub(super) async fn close(&mut self) -> bool

End the session: a WebSocket gets closed, the SPDY streams end and the writer flushes what is queued, shuts the connection down and ends it. A client which takes it slowly gets all of it, one which stopped reading gets the connection ended after STALL_TIMEOUT, counted from the status on, see Self::idle_timeout. Whether the close went out, which the client of a WebSocket answers.

Source

async fn send(&mut self, message: Message) -> Result<()>

Send a WebSocket message. A failure ends the session, unless the client closed the connection cleanly, see Output.

Source

fn closed(&self) -> bool

A send failed after a clean close: of a WebSocket, or of a SPDY connection which ended after the stdin of the client ended. A stream of a connection which is still up got reset, which fails the session.

Source

fn sent(&mut self, result: Result<()>) -> Result<()>

Auto Trait Implementations§

§

impl !Freeze for Output

§

impl !RefUnwindSafe for Output

§

impl !UnwindSafe for Output

§

impl Send for Output

§

impl Sync for Output

§

impl Unpin for Output

§

impl UnsafeUnpin for Output

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more