[Improved] TlsStream impl poll_{read, write}
This commit is contained in:
parent
ffdf1ebcb8
commit
9394405512
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tokio-rustls"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
authors = ["quininer kel <quininer@live.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/quininer/tokio-rustls"
|
||||
|
18
src/lib.rs
18
src/lib.rs
@ -218,4 +218,20 @@ impl<S, C> io::Write for TlsStream<S, C>
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, C> Io for TlsStream<S, C> where S: Io, C: Session {}
|
||||
impl<S, C> Io for TlsStream<S, C> where S: Io, C: Session {
|
||||
fn poll_read(&mut self) -> Async<()> {
|
||||
if !self.eof && self.session.wants_read() && self.io.poll_read().is_not_ready() {
|
||||
Async::NotReady
|
||||
} else {
|
||||
Async::Ready(())
|
||||
}
|
||||
}
|
||||
|
||||
fn poll_write(&mut self) -> Async<()> {
|
||||
if self.session.wants_write() && self.io.poll_write().is_not_ready() {
|
||||
Async::NotReady
|
||||
} else {
|
||||
Async::Ready(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user