stream and sink split

This commit is contained in:
cel 🌸 2024-12-22 19:55:48 +00:00
parent 6385e43e8c
commit 27f90bd85f
1 changed files with 4 additions and 8 deletions

View File

@ -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);
}
}