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: script:
- cargo test --all-features - cargo test --all-features
- cd examples/server
- cargo check
- cd ../../examples/client
- cargo check

View File

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

View File

@ -1,9 +1,7 @@
environment: environment:
matrix: matrix:
- TARGET: x86_64-pc-windows-msvc - TARGET: x86_64-pc-windows-msvc
BITS: 64
- TARGET: i686-pc-windows-msvc - TARGET: i686-pc-windows-msvc
BITS: 32
install: install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
@ -16,3 +14,7 @@ build: false
test_script: test_script:
- 'cargo test --all-features' - '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" futures = "0.2.0-beta"
clap = "2.26" 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); return Ok(0);
} }
// TODO nll match Stream::new(&mut self.session, &mut self.io).read(buf) {
let result = {
let (io, session) = self.get_mut();
let mut stream = Stream::new(session, io);
stream.read(buf)
};
match result {
Ok(0) => { self.eof = true; Ok(0) }, Ok(0) => { self.eof = true; Ok(0) },
Ok(n) => Ok(n), Ok(n) => Ok(n),
Err(ref e) if e.kind() == io::ErrorKind::ConnectionAborted => { 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 where S: io::Read + io::Write, C: Session
{ {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let (io, session) = self.get_mut(); Stream::new(&mut self.session, &mut self.io).write(buf)
let mut stream = Stream::new(session, io);
stream.write(buf)
} }
fn flush(&mut self) -> io::Result<()> { fn flush(&mut self) -> io::Result<()> {
{ Stream::new(&mut self.session, &mut self.io).flush()?;
let (io, session) = self.get_mut();
let mut stream = Stream::new(session, io);
stream.flush()?;
}
self.io.flush() self.io.flush()
} }
} }