pub enum Reason<U>{
Service,
Io(Option<Error>),
Encoder(<U as Encoder>::Error),
Decoder(<U as Decoder>::Error),
KeepAlive,
ReadTimeout,
WriteTimeout,
}Expand description
Reason a dispatcher is stopping.
Carried by DispatchItem::Stop, rather than returned as the dispatcher’s
error type. The dispatcher also reports the corresponding
ntex_io::CloseReason to the transport. An already-recorded transport
close reason is not overwritten.
A stop caused by I/O, codec, or timeout failure can still yield Ok(())
from the dispatcher if no service error is recorded. Inspect the stop
event, or IoRef::close_reason after the
dispatcher completes, when the application needs to distinguish those
outcomes; see the crate-level docs.
Variants§
Service
A service readiness check or event call failed.
The service error is retained for the dispatcher’s result; this notification does not contain or clone it.
Io(Option<Error>)
The transport closed or failed.
None indicates closure without an underlying I/O error, including
clean peer EOF. Some(error) contains a transport error or an
io::ErrorKind::UnexpectedEof synthesized when peer EOF leaves
undecodable bytes in the read buffer.
Encoder(<U as Encoder>::Error)
A service response could not be encoded.
Contains the error returned by Encoder::encode.
Decoder(<U as Decoder>::Error)
Incoming bytes could not be decoded.
Contains the error returned by Decoder::decode.
KeepAlive
The connection’s idle timeout expired.
Usually caused by the configured keep-alive timeout. An external
ntex_io::IoRef::notify_timeout notification can also produce this
reason when no service call is in flight, even if keep-alive is disabled.
ReadTimeout
Frame-read progress was insufficient or its cumulative budget expired.
Controlled by
IoConfig::set_frame_read_rate.
Completing a frame ends its read-rate tracking; subsequent idle time
is governed by keep-alive instead.
WriteTimeout
Write backpressure stayed enabled for longer than the configured write timeout.
Small writes do not extend the deadline unless they release
backpressure. Once pressure is released, the timeout ends even if
some output remains buffered. See
IoConfig::set_write_timeout.