xmlstream: fix clean shutdown sequence

Without the early return in XmlStream::poll_next in case of the stream
footer, the read state gets recreated and the logic at the top of that
function to actually handle stream shutdown gracefully is never
triggered.

Also that logic was incorrect; the correct behaviour is to wait for the
true EOF.
This commit is contained in:
Jonas Schäfer 2024-08-18 10:49:29 +02:00
commit 960fd782bd
2 changed files with 25 additions and 6 deletions

View file

@ -460,13 +460,14 @@ impl<T: FromXml> ReadXsoState<T> {
*self = ReadXsoState::Done;
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::InvalidData,
"end of parent element before XSO started",
"eof before XSO started",
)
.into()));
}
}
}
ReadXsoState::Parsing(builder) => {
log::trace!("ReadXsoState::Parsing ev = {:?}", ev);
let Some(ev) = ev else {
*self = ReadXsoState::Done;
return Poll::Ready(Err(io::Error::new(