@@ -4,7 +4,7 @@ use core::net::SocketAddr;
4
4
use embedded_io:: Error ;
5
5
6
6
use crate :: asynch:: Session ;
7
- use crate :: { Certificates , TlsReference , Mode , TlsError , TlsVersion } ;
7
+ use crate :: { Certificates , Mode , TlsError , TlsReference , TlsVersion } ;
8
8
9
9
/// An implementation of `edge-nal`'s `TcpAccept` trait over TLS.
10
10
pub struct TlsAcceptor < ' d , T > {
19
19
T : edge_nal:: TcpAccept ,
20
20
{
21
21
/// Create a new instance of the `TlsAcceptor` type.
22
- ///
22
+ ///
23
23
/// Arguments:
24
- ///
24
+ ///
25
25
/// * `acceptor` - The underlying TCP acceptor
26
26
/// * `min_version` - The minimum TLS version to support
27
27
/// * `certificates` - The certificates to use for each accepted TLS connection
84
84
T : edge_nal:: TcpConnect ,
85
85
{
86
86
/// Create a new instance of the `TlsConnector` type.
87
- ///
87
+ ///
88
88
/// Arguments:
89
- ///
89
+ ///
90
90
/// * `connector` - The underlying TCP connector
91
91
/// * `servername` - The server name to check against the certificate presented by the server
92
92
/// * `min_version` - The minimum TLS version to support
@@ -114,9 +114,9 @@ where
114
114
T : edge_nal:: TcpConnect ,
115
115
{
116
116
type Error = TlsError ;
117
-
117
+
118
118
type Socket < ' a > = Session < ' a , T :: Socket < ' a > > where Self : ' a ;
119
-
119
+
120
120
async fn connect ( & self , remote : SocketAddr ) -> Result < Self :: Socket < ' _ > , Self :: Error > {
121
121
let socket = self
122
122
. connector
@@ -127,7 +127,9 @@ where
127
127
128
128
let session = Session :: new (
129
129
socket,
130
- Mode :: Client { servername : self . servername } ,
130
+ Mode :: Client {
131
+ servername : self . servername ,
132
+ } ,
131
133
self . min_version ,
132
134
self . certificates ,
133
135
self . tls_ref ,
@@ -142,9 +144,9 @@ where
142
144
T : edge_nal:: Readable ,
143
145
{
144
146
async fn readable ( & mut self ) -> Result < ( ) , Self :: Error > {
145
- // ... 1- because it is difficult to figure out - with the MbedTLS API - if `Session::read` would return without blocking
146
- // For this, we need support for that in MbedTLS itself, which is not available at the moment.
147
- // 2- because `Readable` currently throws exception with `edge-nal-embassy`
147
+ // ... 1- because it is difficult to figure out - with the MbedTLS API - if `Session::read` would return without blocking
148
+ // For this, we need support for that in MbedTLS itself, which is not available at the moment.
149
+ // 2- because `Readable` currently throws exception with `edge-nal-embassy`
148
150
Ok ( ( ) )
149
151
}
150
152
}
@@ -163,6 +165,9 @@ where
163
165
}
164
166
165
167
async fn abort ( & mut self ) -> Result < ( ) , Self :: Error > {
166
- self . stream . abort ( ) . await . map_err ( |e| TlsError :: Io ( e. kind ( ) ) )
168
+ self . stream
169
+ . abort ( )
170
+ . await
171
+ . map_err ( |e| TlsError :: Io ( e. kind ( ) ) )
167
172
}
168
173
}
0 commit comments