diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-01-23 09:08:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-23 09:08:27 +0000 |
commit | 1b546380c41fc03be3dcf44531582edbc5b94018 (patch) | |
tree | 0def138cee98052143ddef58e8ddbafef505aaa6 | |
parent | d6755a59a5356b8cd32d7a14aaf7340bb3f8f832 (diff) | |
parent | 31ec3e6f7aa20578af04a647e424ee1c72e68ef6 (diff) |
Merge #166
166: Fix: Read from connection until no more bytes are returned r=TheNeikos a=matthiasbeyer
Extracted from #133
Co-authored-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | mqtt-tester/src/command.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mqtt-tester/src/command.rs b/mqtt-tester/src/command.rs index 18c143d..e0b531a 100644 --- a/mqtt-tester/src/command.rs +++ b/mqtt-tester/src/command.rs @@ -117,10 +117,18 @@ impl Output { tracing::trace!("Rest-Len: {}", rest_len); let mut rest_buf = buffer.limit(rest_len as usize); - self.stdout - .read_buf(&mut rest_buf) - .await - .into_diagnostic()?; + loop { + let read_len = self + .stdout + .read_buf(&mut rest_buf) + .await + .into_diagnostic()?; + + tracing::trace!("Read {} bytes", read_len); + if read_len == 0 { + break; + } + } Ok::<_, miette::Error>(rest_buf.into_inner()) } .instrument(tracing::trace_span!("Reading bytes from connection")), |