diff --git a/gday/src/main.rs b/gday/src/main.rs index 8b8810a..5fd466c 100644 --- a/gday/src/main.rs +++ b/gday/src/main.rs @@ -195,7 +195,7 @@ async fn run(args: crate::Args) -> Result<(), Box> { .await .map_err(|_| gday_hole_punch::Error::HolePunchTimeout)??; - // Gracefully close the server connection + // Gracefully terminate TLS server_connection.shutdown().await?; let mut stream = EncryptedStream::encrypt_connection(stream, &shared_key).await?; @@ -264,7 +264,7 @@ async fn run(args: crate::Args) -> Result<(), Box> { .await .map_err(|_| gday_hole_punch::Error::HolePunchTimeout)??; - // Gracefully close the server connection + // Gracefully terminate TLS server_connection.shutdown().await?; let mut stream = EncryptedStream::encrypt_connection(stream, &shared_key).await?; diff --git a/gday_encryption/tests/test_integration.rs b/gday_encryption/tests/test_integration.rs index 1719bdf..c8fed4b 100644 --- a/gday_encryption/tests/test_integration.rs +++ b/gday_encryption/tests/test_integration.rs @@ -38,8 +38,6 @@ async fn test_transfers() { stream_a.write_all(chunk).await.unwrap(); stream_a.flush().await.unwrap(); } - // Ensure calling shutdown multiple times works - stream_a.shutdown().await.unwrap(); stream_a.shutdown().await.unwrap(); }); @@ -97,7 +95,6 @@ async fn test_bufread() { } stream_a.shutdown().await.unwrap(); - stream_a.shutdown().await.unwrap(); }); // Stream that will receive the test data sent to the loopback address. diff --git a/gday_server/src/connection_handler.rs b/gday_server/src/connection_handler.rs index 8a4167d..8024dad 100644 --- a/gday_server/src/connection_handler.rs +++ b/gday_server/src/connection_handler.rs @@ -27,10 +27,10 @@ pub async fn handle_connection( } }; let _ = handle_requests(&mut tls_stream, state, origin).await; + // Graceful TLS termination let _ = tls_stream.shutdown().await; } else { let _ = handle_requests(&mut tcp_stream, state, origin).await; - let _ = tcp_stream.shutdown().await; } }