diff options
Diffstat (limited to 'src/jabber.rs')
-rw-r--r-- | src/jabber.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/jabber.rs b/src/jabber.rs index a1b2a2f..a48751c 100644 --- a/src/jabber.rs +++ b/src/jabber.rs @@ -117,11 +117,12 @@ impl<'j> Jabber<'j> { .connect(&self.server, socket) .await { - let (read, writer) = tokio::io::split(stream); + let (read, write) = tokio::io::split(stream); let reader = Reader::from_reader(BufReader::new(read)); - return Ok(JabberClientType::Encrypted( - client::encrypted::JabberClient::new(reader, writer, self), - )); + let writer = Writer::new(write); + let mut client = client::encrypted::JabberClient::new(reader, writer, self); + client.start_stream().await?; + return Ok(JabberClientType::Encrypted(client)); } } false => { @@ -129,9 +130,10 @@ impl<'j> Jabber<'j> { let (read, write) = tokio::io::split(stream); let reader = Reader::from_reader(BufReader::new(read)); let writer = Writer::new(write); - return Ok(JabberClientType::Unencrypted( - client::unencrypted::JabberClient::new(reader, writer, self), - )); + let mut client = + client::unencrypted::JabberClient::new(reader, writer, self); + client.start_stream().await?; + return Ok(JabberClientType::Unencrypted(client)); } } } |