aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2024-12-22 19:55:48 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2024-12-22 19:55:48 +0000
commit27f90bd85f2abf2ecdac69880801d657f125b6ce (patch)
tree3f2de07e19742f493f93e232ae15313640ebc32c
parent6385e43e8ca467e53c6a705a932016c5af75c3a2 (diff)
downloadluz-27f90bd85f2abf2ecdac69880801d657f125b6ce.tar.gz
luz-27f90bd85f2abf2ecdac69880801d657f125b6ce.tar.bz2
luz-27f90bd85f2abf2ecdac69880801d657f125b6ce.zip
stream and sink split
-rw-r--r--jabber/src/client.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/jabber/src/client.rs b/jabber/src/client.rs
index 32b8f6e..f5d5dc7 100644
--- a/jabber/src/client.rs
+++ b/jabber/src/client.rs
@@ -349,12 +349,11 @@ mod tests {
sleep(Duration::from_secs(5)).await;
let jid = client.jid.clone();
let server = client.server.clone();
- let mut client = Arc::new(Mutex::new(client));
+ let (mut write, mut read) = client.split();
tokio::join!(
async {
- let mut client = client.lock().await;
- client
+ write
.send(Stanza::Iq(Iq {
from: Some(jid.clone()),
id: "c2s1".to_string(),
@@ -365,10 +364,7 @@ mod tests {
errors: Vec::new(),
}))
.await;
- },
- async {
- let mut client = client.lock().await;
- client
+ write
.send(Stanza::Iq(Iq {
from: Some(jid.clone()),
id: "c2s2".to_string(),
@@ -381,7 +377,7 @@ mod tests {
.await;
},
async {
- while let Some(stanza) = client.lock().await.next().await {
+ while let Some(stanza) = read.next().await {
info!("{:#?}", stanza);
}
}