#[non_exhaustive]pub enum ConnectionState<'c, 'i, Data> {
ReadTraffic(ReadTraffic<'c, 'i, Data>),
PeerClosed,
Closed,
ReadEarlyData(ReadEarlyData<'c, 'i, Data>),
EncodeTlsData(EncodeTlsData<'c, Data>),
TransmitTlsData(TransmitTlsData<'c, Data>),
BlockedHandshake,
WriteTraffic(WriteTraffic<'c, Data>),
}展开描述
此 state of the UnbufferedConnectionCommon object
变体 (Non-exhaustive)§
This enum is marked as non-exhaustive
ReadTraffic(ReadTraffic<'c, 'i, Data>)
One, 或 more, application data records are available
,请参见ReadTraffic 用于 more details on how 到 use the enclosed object 到 access
the received data.
PeerClosed
Connection has been cleanly closed by the peer.
This state is encountered at most once by each connection – it is “edge” triggered, rather than “level” triggered.
It delimits 数据 received 从 the peer, meaning you can be sure you have received all 数据 the peer sent.
No further application data , received 从 the peer, so no further
ReadTraffic states , produced.
However, it is possible 到 send further application data via WriteTraffic
states, 或 close the connection cleanly by calling
WriteTraffic::queue_close_notify()。
Closed
Connection has been cleanly closed by both us 并 the peer.
This 是 terminal state. No other states , produced 用于 this connection.
ReadEarlyData(ReadEarlyData<'c, 'i, Data>)
One, 或 more, early (RTT-0) data records are available
EncodeTlsData(EncodeTlsData<'c, Data>)
A Handshake record is ready 用于 encoding
Call EncodeTlsData::encode on the enclosed object, providing an outgoing_tls
缓冲区 到 store the encoding
TransmitTlsData(TransmitTlsData<'c, Data>)
Previously encoded handshake records need 到 be transmitted
Transmit the contents of the outgoing_tls 缓冲区 that was passed 到 previous
EncodeTlsData::encode calls 到 the peer.
After transmitting the contents, call TransmitTlsData::done on the enclosed object.
此 transmitted contents MUST not be sent 到 the peer more than once so they SHOULD be
discarded at this point.
At some stages of the handshake process, it’s possible 到 send application-data alongside
handshake records. Call TransmitTlsData::may_encrypt_app_data on the enclosed
object 到 probe if that’s allowed.
BlockedHandshake
More TLS data is needed 到 continue with the handshake
Request more data 从 the peer 并 append the contents 到 the incoming_tls 缓冲区 that
was passed 到 UnbufferedConnectionCommon::process_tls_records。
WriteTraffic(WriteTraffic<'c, Data>)
此 handshake process has been completed.
WriteTraffic::encrypt can be called on the enclosed object 到 encrypt application
data into an outgoing_tls 缓冲区. Similarly, WriteTraffic::queue_close_notify can
be 用 到 encrypt 一个 close_notify alert message into 缓冲区 到 signal the peer that the
connection is being closed. Data written into outgoing_buffer by either method MAY be
transmitted 到 the peer during this state.
Once this state has been reached, data MAY be requested 从 the peer 并 appended 到 an
incoming_tls 缓冲区 that , passed 到 一个 future
UnbufferedConnectionCommon::process_tls_records invocation. When enough data has been
appended 到 incoming_tls, UnbufferedConnectionCommon::process_tls_records will yield
the ConnectionState::ReadTraffic state.