[Fixed] call only once send_close_notify
This commit is contained in:
parent
037f84ea98
commit
aefc023dd4
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tokio-rustls"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["quininer kel <quininer@live.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/quininer/tokio-rustls"
|
||||
@ -10,6 +10,10 @@ readme = "README.md"
|
||||
description = "Asynchronous TLS/SSL streams for Tokio using Rustls."
|
||||
categories = ["asynchronous", "cryptography", "network-programming"]
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "quininer/tokio-rustls" }
|
||||
appveyor = { repository = "quininer/tokio-rustls" }
|
||||
|
||||
[features]
|
||||
danger = [ "rustls/dangerous_configuration" ]
|
||||
|
||||
@ -22,7 +26,7 @@ tokio-proto = { version = "0.1", optional = true }
|
||||
[dev-dependencies]
|
||||
tokio-core = "0.1"
|
||||
clap = "2.20"
|
||||
webpki-roots = "0.11.0"
|
||||
webpki-roots = "0.12"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
tokio-file-unix = "0.4"
|
||||
|
@ -1,5 +1,10 @@
|
||||
# tokio-rustls
|
||||
[![crates](https://img.shields.io/crates/v/tokio-rustls.svg)](https://crates.io/crates/tokio-rustls) [![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/quininer/tokio-rustls/blob/master/LICENSE-MIT) [![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/quininer/tokio-rustls/blob/master/LICENSE-APACHE) [![docs.rs](https://docs.rs/tokio-rustls/badge.svg)](https://docs.rs/tokio-rustls/)
|
||||
[![travis-ci](https://travis-ci.org/quininer/tokio-rustls.svg?branch=master)](https://travis-ci.org/quininer/tokio-rustls)
|
||||
[![appveyor](https://ci.appveyor.com/api/projects/status/4ukw15enii50suqi?svg=true)](https://ci.appveyor.com/project/quininer/tokio-rustls)
|
||||
[![crates](https://img.shields.io/crates/v/tokio-rustls.svg)](https://crates.io/crates/tokio-rustls)
|
||||
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/quininer/tokio-rustls/blob/master/LICENSE-MIT)
|
||||
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/quininer/tokio-rustls/blob/master/LICENSE-APACHE)
|
||||
[![docs.rs](https://docs.rs/tokio-rustls/badge.svg)](https://docs.rs/tokio-rustls/)
|
||||
|
||||
Asynchronous TLS/SSL streams for [Tokio](https://tokio.rs/) using
|
||||
[Rustls](https://github.com/ctz/rustls).
|
||||
|
@ -165,6 +165,7 @@ impl<S, C> Future for MidHandshake<S, C>
|
||||
/// protocol.
|
||||
#[derive(Debug)]
|
||||
pub struct TlsStream<S, C> {
|
||||
is_shutdown: bool,
|
||||
eof: bool,
|
||||
io: S,
|
||||
session: C
|
||||
@ -186,6 +187,7 @@ impl<S, C> TlsStream<S, C>
|
||||
#[inline]
|
||||
pub fn new(io: S, session: C) -> TlsStream<S, C> {
|
||||
TlsStream {
|
||||
is_shutdown: false,
|
||||
eof: false,
|
||||
io: io,
|
||||
session: session
|
||||
@ -310,7 +312,10 @@ impl<S, C> AsyncWrite for TlsStream<S, C>
|
||||
C: Session
|
||||
{
|
||||
fn shutdown(&mut self) -> Poll<(), io::Error> {
|
||||
if !self.is_shutdown {
|
||||
self.session.send_close_notify();
|
||||
self.is_shutdown = true;
|
||||
}
|
||||
while self.session.wants_write() {
|
||||
try_nb!(self.session.write_tls(&mut self.io));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user