diff --git a/src/tls_connection.rs b/src/tls_connection.rs index 2e3ed528..05bff627 100644 --- a/src/tls_connection.rs +++ b/src/tls_connection.rs @@ -177,17 +177,9 @@ where /// Close a connection instance, returning the ownership of the config, random generator and the async I/O provider. pub async fn close(self) -> Result<(TlsContext<'a, CipherSuite, RNG>, Socket), TlsError> { - let record = if self.opened { - ClientRecord::Alert( - Alert::new(AlertLevel::Warning, AlertDescription::CloseNotify), - true, - ) - } else { - ClientRecord::Alert( - Alert::new(AlertLevel::Warning, AlertDescription::CloseNotify), - false, - ) - }; + let record = ClientRecord::Alert( + Alert::new(AlertLevel::Warning, AlertDescription::CloseNotify), + self.opened); let mut key_schedule = self.key_schedule; let mut delegate = self.delegate;