fix problems with empty socket receive buffers

This commit is contained in:
Sebastien Bourdeauducq 2020-04-15 09:25:05 +08:00
parent f604f23a22
commit b6c0f0baed
2 changed files with 8 additions and 12 deletions

14
Cargo.lock generated
View File

@ -26,9 +26,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]] [[package]]
name = "compiler_builtins" name = "compiler_builtins"
version = "0.1.26" version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "036b035e9ebcd705affece16319223d19f229e2358be6e3b7b094e57193312e6" checksum = "38f18416546abfbf8d801c555a0e99524453e7214f9cc9107ad49de3d5948ccc"
[[package]] [[package]]
name = "cslice" name = "cslice"
@ -43,7 +43,7 @@ version = "0.1.0"
[[package]] [[package]]
name = "libasync" name = "libasync"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#b26327e474ef224c91f704b7f513a1495a981f87" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#be35be8d381449149040938f24c124861da9860e"
dependencies = [ dependencies = [
"libcortex_a9", "libcortex_a9",
"pin-utils", "pin-utils",
@ -53,7 +53,7 @@ dependencies = [
[[package]] [[package]]
name = "libboard_zynq" name = "libboard_zynq"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#b26327e474ef224c91f704b7f513a1495a981f87" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#be35be8d381449149040938f24c124861da9860e"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"libcortex_a9", "libcortex_a9",
@ -65,7 +65,7 @@ dependencies = [
[[package]] [[package]]
name = "libcortex_a9" name = "libcortex_a9"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#b26327e474ef224c91f704b7f513a1495a981f87" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#be35be8d381449149040938f24c124861da9860e"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"libregister", "libregister",
@ -74,7 +74,7 @@ dependencies = [
[[package]] [[package]]
name = "libregister" name = "libregister"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#b26327e474ef224c91f704b7f513a1495a981f87" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#be35be8d381449149040938f24c124861da9860e"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"vcell", "vcell",
@ -84,7 +84,7 @@ dependencies = [
[[package]] [[package]]
name = "libsupport_zynq" name = "libsupport_zynq"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#b26327e474ef224c91f704b7f513a1495a981f87" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#be35be8d381449149040938f24c124861da9860e"
dependencies = [ dependencies = [
"compiler_builtins", "compiler_builtins",
"libboard_zynq", "libboard_zynq",

View File

@ -67,11 +67,7 @@ async fn expect(stream: &TcpStream, pattern: &[u8]) -> Result<()> {
async fn read_i8(stream: &TcpStream) -> Result<i8> { async fn read_i8(stream: &TcpStream) -> Result<i8> {
Ok(stream.recv(|buf| { Ok(stream.recv(|buf| {
if buf.len() >= 1 {
Poll::Ready((1, buf[0] as i8)) Poll::Ready((1, buf[0] as i8))
} else {
Poll::Pending
}
}).await?) }).await?)
} }