|
|
@ -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() { |
|
|
|