From fd437df67ee5b6ae01dcb61c033ad581402685cd Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Sat, 6 Apr 2024 09:23:12 +0000 Subject: [PATCH] xmpp: buffer data outgoing over a TLS-stream --- crates/projection-xmpp/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/projection-xmpp/src/lib.rs b/crates/projection-xmpp/src/lib.rs index a2a0a5b..3b71b84 100644 --- a/crates/projection-xmpp/src/lib.rs +++ b/crates/projection-xmpp/src/lib.rs @@ -185,7 +185,7 @@ async fn handle_socket( let (a, b) = tokio::io::split(new_stream); let mut xml_reader = NsReader::from_reader(BufReader::new(a)); - let mut xml_writer = Writer::new(b); + let mut xml_writer = Writer::new(BufWriter::new(b)); pin!(termination); select! { @@ -216,7 +216,7 @@ async fn handle_socket( } let a = xml_reader.into_inner().into_inner(); - let b = xml_writer.into_inner(); + let b = xml_writer.into_inner().into_inner(); a.unsplit(b).shutdown().await?; Ok(()) } @@ -284,6 +284,7 @@ async fn socket_auth( let auth: proto_xmpp::sasl::Auth = proto_xmpp::sasl::Auth::parse(xml_reader, reader_buf).await?; proto_xmpp::sasl::Success.write_xml(xml_writer).await?; + xml_writer.get_mut().flush().await?; match AuthBody::from_str(&auth.body) { Ok(logopass) => {