Skip to content

Commit a58a6e9

Browse files
lucabdjc
authored andcommitted
server: allow splitting and reassembling a StartHandshake
This adds two methods to the existing `StartHandshake` in order to allow splitting and reconstructing the underlying components.
1 parent 97745c3 commit a58a6e9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/server.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ impl<IO> StartHandshake<IO>
205205
where
206206
IO: AsyncRead + AsyncWrite + Unpin,
207207
{
208+
/// Create a new object from an `IO` transport and prior TLS metadata.
209+
pub fn from_parts(transport: IO, accepted: rustls::server::Accepted) -> Self {
210+
Self {
211+
accepted,
212+
io: transport,
213+
}
214+
}
215+
216+
/// Consume this object and return the underlying components.
217+
pub fn into_parts(self) -> (IO, rustls::server::Accepted) {
218+
(self.io, self.accepted)
219+
}
220+
208221
pub fn client_hello(&self) -> rustls::server::ClientHello<'_> {
209222
self.accepted.client_hello()
210223
}

0 commit comments

Comments
 (0)