Update to bytes 1.0

pull/163/head
Constantin Nickel 4 years ago
parent a7daafdfc8
commit 8417078ef3
  1. 4
      Cargo.toml
  2. 4
      src/handshake/machine.rs

@ -20,10 +20,10 @@ tls-vendored = ["native-tls", "native-tls/vendored"]
[dependencies] [dependencies]
base64 = "0.13.0" base64 = "0.13.0"
byteorder = "1.3.2" byteorder = "1.3.2"
bytes = "0.5" bytes = "1.0"
http = "0.2" http = "0.2"
httparse = "1.3.4" httparse = "1.3.4"
input_buffer = "0.3.0" input_buffer = { version = "0.3.0", git = "https://github.com/nickelc/input_buffer.git", branch = "bytes" }
log = "0.4.8" log = "0.4.8"
rand = "0.7.2" rand = "0.7.2"
sha-1 = "0.9" sha-1 = "0.9"

@ -51,7 +51,7 @@ impl<Stream: Read + Write> HandshakeMachine<Stream> {
.no_block()?; .no_block()?;
match read { match read {
Some(0) => Err(Error::Protocol("Handshake not finished".into())), Some(0) => Err(Error::Protocol("Handshake not finished".into())),
Some(_) => Ok(if let Some((size, obj)) = Obj::try_parse(Buf::bytes(&buf))? { Some(_) => Ok(if let Some((size, obj)) = Obj::try_parse(Buf::chunk(&buf))? {
buf.advance(size); buf.advance(size);
RoundResult::StageFinished(StageResult::DoneReading { RoundResult::StageFinished(StageResult::DoneReading {
result: obj, result: obj,
@ -72,7 +72,7 @@ impl<Stream: Read + Write> HandshakeMachine<Stream> {
} }
HandshakeState::Writing(mut buf) => { HandshakeState::Writing(mut buf) => {
assert!(buf.has_remaining()); assert!(buf.has_remaining());
if let Some(size) = self.stream.write(Buf::bytes(&buf)).no_block()? { if let Some(size) = self.stream.write(Buf::chunk(&buf)).no_block()? {
assert!(size > 0); assert!(size > 0);
buf.advance(size); buf.advance(size);
Ok(if buf.has_remaining() { Ok(if buf.has_remaining() {

Loading…
Cancel
Save