[Changed] bump version

This commit is contained in:
quininer kel 2017-05-26 18:22:03 +08:00
parent 1cd3e37158
commit 076c266fa1
2 changed files with 12 additions and 16 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.2.1" version = "0.2.2"
authors = ["quininer kel <quininer@live.com>"] authors = ["quininer kel <quininer@live.com>"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
repository = "https://github.com/quininer/tokio-rustls" repository = "https://github.com/quininer/tokio-rustls"

View File

@ -46,12 +46,11 @@ impl ClientConfigExt for Arc<ClientConfig> {
-> ConnectAsync<S> -> ConnectAsync<S>
where S: AsyncRead + AsyncWrite where S: AsyncRead + AsyncWrite
{ {
ConnectAsync(MidHandshake { connect_async_with_session(stream, ClientSession::new(self, domain))
inner: Some(TlsStream::new(stream, ClientSession::new(self, domain)))
})
} }
} }
#[inline]
pub fn connect_async_with_session<S>(stream: S, session: ClientSession) pub fn connect_async_with_session<S>(stream: S, session: ClientSession)
-> ConnectAsync<S> -> ConnectAsync<S>
where S: AsyncRead + AsyncWrite where S: AsyncRead + AsyncWrite
@ -66,12 +65,11 @@ impl ServerConfigExt for Arc<ServerConfig> {
-> AcceptAsync<S> -> AcceptAsync<S>
where S: AsyncRead + AsyncWrite where S: AsyncRead + AsyncWrite
{ {
AcceptAsync(MidHandshake { accept_async_with_session(stream, ServerSession::new(self))
inner: Some(TlsStream::new(stream, ServerSession::new(self)))
})
} }
} }
#[inline]
pub fn accept_async_with_session<S>(stream: S, session: ServerSession) pub fn accept_async_with_session<S>(stream: S, session: ServerSession)
-> AcceptAsync<S> -> AcceptAsync<S>
where S: AsyncRead + AsyncWrite where S: AsyncRead + AsyncWrite
@ -227,7 +225,7 @@ impl<S, C> io::Write for TlsStream<S, C>
where S: AsyncRead + AsyncWrite, C: Session where S: AsyncRead + AsyncWrite, C: Session
{ {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
if buf.len() == 0 { if buf.is_empty() {
return Ok(0); return Ok(0);
} }
@ -237,14 +235,12 @@ impl<S, C> io::Write for TlsStream<S, C>
while self.session.wants_write() { while self.session.wants_write() {
match self.session.write_tls(&mut self.io) { match self.session.write_tls(&mut self.io) {
Ok(_) => (), Ok(_) => (),
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => if output == 0 {
if output == 0 { // Both rustls buffer and IO buffer are blocking.
// Both rustls buffer and IO buffer are blocking. return Err(io::Error::from(io::ErrorKind::WouldBlock));
return Err(io::Error::from(io::ErrorKind::WouldBlock)); } else {
} else { break;
break; },
}
}
Err(e) => return Err(e) Err(e) => return Err(e)
} }
} }