diff --git a/src/transport.rs b/src/transport.rs index 289b6d6..f050656 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -23,6 +23,8 @@ pub trait Transport { fn write_element(&mut self, element: &minidom::Element) -> Result<(), Error>; fn read_element(&mut self) -> Result; + + fn reset_stream(&mut self); } pub struct SslTransport { @@ -49,6 +51,17 @@ impl Transport for SslTransport { fn read_element(&mut self) -> Result { Ok(minidom::Element::from_reader(&mut self.reader)?) } + + fn reset_stream(&mut self) { + let locked_io = LockedIO::from(self.inner.clone()); + self.reader = EventReader::new(locked_io.clone()); + self.writer = EventWriter::new_with_config(locked_io, EmitterConfig { + line_separator: "".into(), + perform_indent: false, + normalize_empty_elements: false, + .. Default::default() + }); + } } impl SslTransport {