File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use hyper::server::{
9
9
accept:: Accept ,
10
10
conn:: { AddrIncoming , AddrStream } ,
11
11
} ;
12
- use rustls:: ServerConfig ;
12
+ use rustls:: { ServerConfig , ServerConnection } ;
13
13
use tokio:: io:: { AsyncRead , AsyncWrite , ReadBuf } ;
14
14
15
15
mod builder;
@@ -77,6 +77,26 @@ impl TlsStream {
77
77
state : State :: Handshaking ( accept) ,
78
78
}
79
79
}
80
+
81
+ /// Returns a reference to the underlying IO stream.
82
+ ///
83
+ /// This should always return `Some`, except if an error has already been yielded.
84
+ pub fn io ( & self ) -> Option < & AddrStream > {
85
+ match & self . state {
86
+ State :: Handshaking ( accept) => accept. get_ref ( ) ,
87
+ State :: Streaming ( stream) => Some ( stream. get_ref ( ) . 0 ) ,
88
+ }
89
+ }
90
+
91
+ /// Returns a reference to the underlying [`rustls::ServerConnection'].
92
+ ///
93
+ /// This will start yielding `Some` only after the handshake has completed.
94
+ pub fn connection ( & self ) -> Option < & ServerConnection > {
95
+ match & self . state {
96
+ State :: Handshaking ( _) => None ,
97
+ State :: Streaming ( stream) => Some ( stream. get_ref ( ) . 1 ) ,
98
+ }
99
+ }
80
100
}
81
101
82
102
impl AsyncRead for TlsStream {
You can’t perform that action at this time.
0 commit comments