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: boolWhether 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
impl Output
Sourcepub(super) fn websocket(
sender: SplitSink<WebSocketStream<ClientIo<TokioIo<Upgraded>>>, Message>,
framing: Framing,
activity: Activity,
written: Activity,
idle_timeout: Option<Duration>,
) -> Self
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.
Sourcepub(super) fn spdy(output: SpdyOutput, idle_timeout: Option<Duration>) -> Self
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.
fn new( transport: Transport, peer_closed: Arc<AtomicBool>, idle_timeout: Option<Duration>, ) -> Self
Sourcepub(super) fn close_too_large(&mut self)
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.
Sourcepub(super) fn peer_closed(&self) -> Arc<AtomicBool> ⓘ
pub(super) fn peer_closed(&self) -> Arc<AtomicBool> ⓘ
Set by the input once the client closed the connection cleanly.
Sourcepub(super) async fn announce(
&mut self,
stdout: bool,
stderr: bool,
) -> Result<()>
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.
Sourcepub(super) async fn data(&mut self, pipe: Pipe, data: &Bytes) -> Result<()>
pub(super) async fn data(&mut self, pipe: Pipe, data: &Bytes) -> Result<()>
Send output of the pipe of the process.
Sourcepub(super) async fn status(&mut self, status: &Status) -> Result<()>
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.
Sourcefn ending(&mut self) -> Instant
fn ending(&mut self) -> Instant
When the end of the session started, the first time this got called.
async fn send_status(&mut self, status: &Status) -> Result<()>
Sourcepub(super) async fn ping(&mut self) -> Result<()>
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.
Sourcepub(super) async fn close(&mut self) -> bool
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.
Sourceasync fn send(&mut self, message: Message) -> Result<()>
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.
Sourcefn closed(&self) -> bool
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.
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> 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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].