@@ -69,7 +69,7 @@ impl<State> TlsListener<State> {
69
69
TlsListenerBuilder :: new ( )
70
70
}
71
71
72
- async fn configure ( & mut self ) -> io:: Result < TlsAcceptor > {
72
+ async fn configure ( & mut self ) -> io:: Result < ( ) > {
73
73
self . config = match std:: mem:: take ( & mut self . config ) {
74
74
TlsListenerConfig :: Paths { cert, key } => {
75
75
let certs = load_certs ( & cert) ?;
@@ -86,17 +86,17 @@ impl<State> TlsListener<State> {
86
86
TlsListenerConfig :: Acceptor ( TlsAcceptor :: from ( Arc :: new ( config) ) )
87
87
}
88
88
89
- other => other,
89
+ other @ TlsListenerConfig :: Acceptor ( _) => other,
90
+
91
+ TlsListenerConfig :: Unconfigured => {
92
+ return Err ( io:: Error :: new (
93
+ io:: ErrorKind :: Other ,
94
+ "could not configure tlslistener" ,
95
+ ) ) ;
96
+ }
90
97
} ;
91
98
92
- if let TlsListenerConfig :: Acceptor ( ref a) = self . config {
93
- Ok ( a. clone ( ) )
94
- } else {
95
- Err ( io:: Error :: new (
96
- io:: ErrorKind :: Other ,
97
- "could not configure tlslistener" ,
98
- ) )
99
- }
99
+ Ok ( ( ) )
100
100
}
101
101
102
102
fn acceptor ( & self ) -> Option < & TlsAcceptor > {
@@ -113,17 +113,12 @@ impl<State> TlsListener<State> {
113
113
}
114
114
}
115
115
116
- async fn connect ( & mut self ) -> io:: Result < & TcpListener > {
116
+ async fn connect ( & mut self ) -> io:: Result < ( ) > {
117
117
if let TcpConnection :: Addrs ( addrs) = & self . connection {
118
118
let tcp = TcpListener :: bind ( & addrs[ ..] ) . await ?;
119
119
self . connection = TcpConnection :: Connected ( tcp) ;
120
120
}
121
-
122
- if let TcpConnection :: Connected ( tcp) = & self . connection {
123
- Ok ( tcp)
124
- } else {
125
- unreachable ! ( )
126
- }
121
+ Ok ( ( ) )
127
122
}
128
123
}
129
124
0 commit comments