Use ServerConfig enum for tokio-xmpp client config

And expose connect_to_host from happy_eyeballs to let clients explicitly
choose to use SRV or not. (Rename connect to connect_with_srv)
This commit is contained in:
Paul Fariello 2020-12-06 15:23:29 +01:00
commit 7b4a6e3ace
4 changed files with 43 additions and 27 deletions

View file

@ -8,7 +8,7 @@ use std::task::Context;
use tokio::net::TcpStream;
use xmpp_parsers::{ns, Element, Jid};
use super::happy_eyeballs::connect;
use super::happy_eyeballs::connect_to_host;
use super::xmpp_codec::Packet;
use super::xmpp_stream;
use super::Error;
@ -43,7 +43,7 @@ impl Component {
port: u16,
) -> Result<XMPPStream, Error> {
let password = password;
let tcp_stream = connect(server, None, port).await?;
let tcp_stream = connect_to_host(server, port).await?;
let mut xmpp_stream =
xmpp_stream::XMPPStream::start(tcp_stream, jid, ns::COMPONENT_ACCEPT.to_owned())
.await?;