stream and sink split
This commit is contained in:
parent
6385e43e8c
commit
27f90bd85f
|
@ -349,12 +349,11 @@ mod tests {
|
||||||
sleep(Duration::from_secs(5)).await;
|
sleep(Duration::from_secs(5)).await;
|
||||||
let jid = client.jid.clone();
|
let jid = client.jid.clone();
|
||||||
let server = client.server.clone();
|
let server = client.server.clone();
|
||||||
let mut client = Arc::new(Mutex::new(client));
|
let (mut write, mut read) = client.split();
|
||||||
|
|
||||||
tokio::join!(
|
tokio::join!(
|
||||||
async {
|
async {
|
||||||
let mut client = client.lock().await;
|
write
|
||||||
client
|
|
||||||
.send(Stanza::Iq(Iq {
|
.send(Stanza::Iq(Iq {
|
||||||
from: Some(jid.clone()),
|
from: Some(jid.clone()),
|
||||||
id: "c2s1".to_string(),
|
id: "c2s1".to_string(),
|
||||||
|
@ -365,10 +364,7 @@ mod tests {
|
||||||
errors: Vec::new(),
|
errors: Vec::new(),
|
||||||
}))
|
}))
|
||||||
.await;
|
.await;
|
||||||
},
|
write
|
||||||
async {
|
|
||||||
let mut client = client.lock().await;
|
|
||||||
client
|
|
||||||
.send(Stanza::Iq(Iq {
|
.send(Stanza::Iq(Iq {
|
||||||
from: Some(jid.clone()),
|
from: Some(jid.clone()),
|
||||||
id: "c2s2".to_string(),
|
id: "c2s2".to_string(),
|
||||||
|
@ -381,7 +377,7 @@ mod tests {
|
||||||
.await;
|
.await;
|
||||||
},
|
},
|
||||||
async {
|
async {
|
||||||
while let Some(stanza) = client.lock().await.next().await {
|
while let Some(stanza) = read.next().await {
|
||||||
info!("{:#?}", stanza);
|
info!("{:#?}", stanza);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue