xmpp: buffer data outgoing over a TLS-stream

This commit is contained in:
Nikita Vilunov 2024-04-06 09:23:12 +00:00
parent a325c7307c
commit fd437df67e
1 changed files with 3 additions and 2 deletions

View File

@ -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) => {