File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
crates/openshell-server/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -206,19 +206,27 @@ pub async fn run_server(config: Config, tracing_log_bus: TracingLogBus) -> Resul
206206 if let Some ( ref acceptor) = tls_acceptor {
207207 let tls_acceptor = acceptor. clone ( ) ;
208208 tokio:: spawn ( async move {
209- match tls_acceptor. inner ( ) . accept ( stream) . await {
210- Ok ( tls_stream) => {
209+ match tokio:: time:: timeout (
210+ std:: time:: Duration :: from_secs ( 10 ) ,
211+ tls_acceptor. inner ( ) . accept ( stream) ,
212+ )
213+ . await
214+ {
215+ Ok ( Ok ( tls_stream) ) => {
211216 if let Err ( e) = service. serve ( tls_stream) . await {
212217 error ! ( error = %e, client = %addr, "Connection error" ) ;
213218 }
214219 }
215- Err ( e) => {
220+ Ok ( Err ( e) ) => {
216221 if is_benign_tls_handshake_failure ( & e) {
217222 debug ! ( error = %e, client = %addr, "TLS handshake closed early" ) ;
218223 } else {
219224 error ! ( error = %e, client = %addr, "TLS handshake failed" ) ;
220225 }
221226 }
227+ Err ( _) => {
228+ debug ! ( client = %addr, "TLS handshake timed out" ) ;
229+ }
222230 }
223231 } ) ;
224232 } else {
You can’t perform that action at this time.
0 commit comments