change: update tokio

This commit is contained in:
quininer 2018-03-24 11:20:48 +08:00
parent 8f2306854e
commit d0f13ce5f9
5 changed files with 11 additions and 27 deletions

View File

@ -8,3 +8,7 @@ os:
script:
- cargo test --all-features
- cd examples/server
- cargo check
- cd ../../examples/client
- cargo check

View File

@ -26,6 +26,3 @@ tokio = "0.1"
[features]
default = [ "unstable-futures", "tokio" ]
unstable-futures = [ "futures", "tokio/unstable-futures" ]
[patch.crates-io]
tokio = { git = "https://github.com/tokio-rs/tokio" }

View File

@ -1,9 +1,7 @@
environment:
matrix:
- TARGET: x86_64-pc-windows-msvc
BITS: 64
- TARGET: i686-pc-windows-msvc
BITS: 32
install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
@ -16,3 +14,7 @@ build: false
test_script:
- 'cargo test --all-features'
- 'cd examples/server'
- 'cargo check'
- 'cd ../../examples/client'
- 'cargo check'

View File

@ -11,7 +11,3 @@ tokio = { version = "0.1", features = [ "unstable-futures" ] }
futures = "0.2.0-beta"
clap = "2.26"
[patch.crates-io]
tokio = { git = "https://github.com/tokio-rs/tokio" }

View File

@ -117,14 +117,7 @@ impl<S, C> io::Read for TlsStream<S, C>
return Ok(0);
}
// TODO nll
let result = {
let (io, session) = self.get_mut();
let mut stream = Stream::new(session, io);
stream.read(buf)
};
match result {
match Stream::new(&mut self.session, &mut self.io).read(buf) {
Ok(0) => { self.eof = true; Ok(0) },
Ok(n) => Ok(n),
Err(ref e) if e.kind() == io::ErrorKind::ConnectionAborted => {
@ -142,19 +135,11 @@ impl<S, C> io::Write for TlsStream<S, C>
where S: io::Read + io::Write, C: Session
{
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let (io, session) = self.get_mut();
let mut stream = Stream::new(session, io);
stream.write(buf)
Stream::new(&mut self.session, &mut self.io).write(buf)
}
fn flush(&mut self) -> io::Result<()> {
{
let (io, session) = self.get_mut();
let mut stream = Stream::new(session, io);
stream.flush()?;
}
Stream::new(&mut self.session, &mut self.io).flush()?;
self.io.flush()
}
}