diff --git a/src/connection.rs b/src/connection.rs index 2b70747..65e9383 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -23,6 +23,7 @@ pub enum Connection { impl Connection { #[instrument] + /// stream not started pub async fn ensure_tls(self) -> Result> { match self { Connection::Encrypted(j) => Ok(j), diff --git a/src/jabber.rs b/src/jabber.rs index 87a2b44..a56c65c 100644 --- a/src/jabber.rs +++ b/src/jabber.rs @@ -6,7 +6,7 @@ use peanuts::{Reader, Writer}; use rsasl::prelude::SASLConfig; use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, BufReader, ReadHalf, WriteHalf}; use tokio_native_tls::native_tls::TlsConnector; -use tracing::{debug, info, trace}; +use tracing::{debug, info, instrument, trace}; use trust_dns_resolver::proto::rr::domain::IntoLabel; use crate::connection::{Tls, Unencrypted}; @@ -54,9 +54,11 @@ where impl Jabber where S: AsyncRead + AsyncWrite + Unpin + Send, + Jabber: std::fmt::Debug, { // pub async fn negotiate(self) -> Result> {} + #[instrument] pub async fn start_stream(&mut self) -> Result<()> { // client to server @@ -109,14 +111,13 @@ impl Jabber { .await { let (read, write) = tokio::io::split(tlsstream); - let mut client = Jabber::new( + let client = Jabber::new( read, write, self.jid.to_owned(), self.auth.to_owned(), self.server.to_owned(), ); - client.start_stream().await?; return Ok(client); } else { return Err(Error::Connection);