mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 05:50:01 -04:00
immediately close ping task instead of waiting for the interval
This commit is contained in:
parent
4239ecb713
commit
888044f63d
1 changed files with 7 additions and 1 deletions
|
@ -258,10 +258,14 @@ pub async fn handle_wisp(stream: WispResult, id: String) -> anyhow::Result<()> {
|
|||
})));
|
||||
|
||||
let ping_mux = mux.clone();
|
||||
let ping_event = event.clone();
|
||||
set.spawn(async move {
|
||||
let mut interval = interval(Duration::from_secs(30));
|
||||
while ping_mux.send_ping(Payload::Bytes(BytesMut::new())).await.is_ok() {
|
||||
interval.tick().await;
|
||||
select! {
|
||||
_ = interval.tick() => (),
|
||||
_ = ping_event.listen() => break,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -281,6 +285,8 @@ pub async fn handle_wisp(stream: WispResult, id: String) -> anyhow::Result<()> {
|
|||
let _ = mux.close().await;
|
||||
event.notify(usize::MAX);
|
||||
|
||||
trace!("waiting for tasks to close for wisp client id {:?}", id);
|
||||
|
||||
while set.join_next().await.is_some() {}
|
||||
|
||||
debug!("wisp client id {:?} disconnected", id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue