forked from lavina/lavina
xmpp: buffer data outgoing over a TLS-stream
This commit is contained in:
parent
a325c7307c
commit
fd437df67e
|
@ -185,7 +185,7 @@ async fn handle_socket(
|
||||||
|
|
||||||
let (a, b) = tokio::io::split(new_stream);
|
let (a, b) = tokio::io::split(new_stream);
|
||||||
let mut xml_reader = NsReader::from_reader(BufReader::new(a));
|
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);
|
pin!(termination);
|
||||||
select! {
|
select! {
|
||||||
|
@ -216,7 +216,7 @@ async fn handle_socket(
|
||||||
}
|
}
|
||||||
|
|
||||||
let a = xml_reader.into_inner().into_inner();
|
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?;
|
a.unsplit(b).shutdown().await?;
|
||||||
Ok(())
|
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?;
|
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?;
|
proto_xmpp::sasl::Success.write_xml(xml_writer).await?;
|
||||||
|
xml_writer.get_mut().flush().await?;
|
||||||
|
|
||||||
match AuthBody::from_str(&auth.body) {
|
match AuthBody::from_str(&auth.body) {
|
||||||
Ok(logopass) => {
|
Ok(logopass) => {
|
||||||
|
|
Loading…
Reference in New Issue