tokio-xmpp: do not discard XmlLangStack when boxing the stream
The stream may have read some data already (such as the stream header). When initially writing this code, I had missed that we do actually also carry the parser state over: I misread the AsyncReader::wrap(..) command as something like AsyncReader::new, i.e. starting off with fresh parser state, so I assumed that we need a fresh XmlLangStack, too. This is wrong: `p` comes from `self.parser.into_inner()` above and is the parser state, so we need to carry the lang stack along, as well. This fixes: ``` thread 'tokio-runtime-worker' panicked at […]/rxml-0.13.1/src/xml_lang.rs:87:13: pop from empty XmlLangStack ``` happening during stream shutdown. The panic was first reported by @ppjet6, so thanks for that and the keen eye. skip-changelog, because the bug has not been released yet.
This commit is contained in:
parent
7f0a7b2247
commit
51ce661f8d
1 changed files with 1 additions and 1 deletions
|
|
@ -300,7 +300,7 @@ impl<Io: AsyncBufRead + AsyncWrite> RawXmlStream<Io> {
|
|||
let parser = rxml::AsyncReader::wrap(io, p);
|
||||
RawXmlStream {
|
||||
parser,
|
||||
lang_stack: XmlLangStack::new(),
|
||||
lang_stack: self.lang_stack,
|
||||
timeouts: self.timeouts,
|
||||
writer: self.writer,
|
||||
tx_buffer: self.tx_buffer,
|
||||
|
|
|
|||
Loading…
Reference in a new issue