Ensure connection is closed on abort (#801)

When aborting a connection, ensure the underlying stream is closed
before we return.
This commit is contained in:
André Cruz
2022-07-19 20:13:51 +01:00
committed by GitHub
parent 62725af00a
commit 17c95b0fa8
2 changed files with 2 additions and 0 deletions

View File

@@ -194,6 +194,7 @@ impl AsyncSmtpConnection {
self.panic = true;
let _ = self.command(Quit).await;
}
let _ = self.stream.close().await;
}
/// Sets the underlying stream

View File

@@ -183,6 +183,7 @@ impl SmtpConnection {
self.panic = true;
let _ = self.command(Quit);
}
let _ = self.stream.get_mut().shutdown(std::net::Shutdown::Both);
}
/// Sets the underlying stream