From 4f8b273e86f995970bcc0a4db7a260775c677e1e Mon Sep 17 00:00:00 2001 From: occheung Date: Tue, 1 Dec 2020 16:22:08 +0800 Subject: [PATCH] socket: beautify lifetime --- src/tls.rs | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/tls.rs b/src/tls.rs index f773539..e9f3a92 100644 --- a/src/tls.rs +++ b/src/tls.rs @@ -57,22 +57,22 @@ pub(crate) enum TlsState { SERVER_CONNECTED, } -pub struct TlsSocket<'s> +pub struct TlsSocket<'b> { tcp_handle: SocketHandle, - rng: &'s mut dyn crate::TlsRng, - session: RefCell>, + rng: &'b mut dyn crate::TlsRng, + session: RefCell>, } -impl<'s> TlsSocket<'s> { - pub fn new<'a, 'b, 'c>( +impl<'b> TlsSocket<'b> { + pub fn new<'a, 'c>( sockets: &mut SocketSet<'a, 'b, 'c>, rx_buffer: TcpSocketBuffer<'b>, tx_buffer: TcpSocketBuffer<'b>, - rng: &'s mut dyn crate::TlsRng, + rng: &'b mut dyn crate::TlsRng, certificate_with_key: Option<( crate::session::CertificatePrivateKey, - Vec<&'s [u8]> + Vec<&'b [u8]> )> ) -> Self where @@ -89,22 +89,22 @@ impl<'s> TlsSocket<'s> { } } - pub fn from_tcp_handle( - tcp_handle: SocketHandle, - rng: &'s mut dyn crate::TlsRng, - certificate_with_key: Option<( - crate::session::CertificatePrivateKey, - Vec<&'s [u8]> - )> - ) -> Self { - TlsSocket { - tcp_handle, - rng, - session: RefCell::new( - Session::new(TlsRole::Client, certificate_with_key) - ), - } - } + // pub fn from_tcp_handle( + // tcp_handle: SocketHandle, + // rng: &'s mut dyn crate::TlsRng, + // certificate_with_key: Option<( + // crate::session::CertificatePrivateKey, + // Vec<&'s [u8]> + // )> + // ) -> Self { + // TlsSocket { + // tcp_handle, + // rng, + // session: RefCell::new( + // Session::new(TlsRole::Client, certificate_with_key) + // ), + // } + // } pub fn connect( &mut self,