Debian Codegraph @

src/common/tls_state.rs

raw symbols SCIP
1 #[derive(Debug, Copy, Clone)]
2 pub(crate) enum TlsState {
3 #[cfg(feature = "early-data")]
4 EarlyData,
5 Stream,
6 ReadShutdown,
7 WriteShutdown,
8 FullyShutdown,
9 }
10
11 impl TlsState {
12 pub(crate) fn shutdown_read(&mut self) {
13 match *self {
14 TlsState::WriteShutdown | TlsState::FullyShutdown => *self = TlsState::FullyShutdown,
15 _ => *self = TlsState::ReadShutdown,
16 }
17 }
18
19 pub(crate) fn shutdown_write(&mut self) {
20 match *self {
21 TlsState::ReadShutdown | TlsState::FullyShutdown => *self = TlsState::FullyShutdown,
22 _ => *self = TlsState::WriteShutdown,
23 }
24 }
25
26 pub(crate) fn writeable(&self) -> bool {
27 match *self {
28 TlsState::WriteShutdown | TlsState::FullyShutdown => false,
29 _ => true,
30 }
31 }
32
33 pub(crate) fn readable(self) -> bool {
34 match self {
35 TlsState::ReadShutdown | TlsState::FullyShutdown => false,
36 _ => true,
37 }
38 }
39 }