quickfix for closing participants more reliable

This commit is contained in:
Marcel Märtens
2020-10-13 20:05:45 +02:00
parent 2246e8b860
commit 24af657fd5
2 changed files with 7 additions and 0 deletions

View File

@ -236,6 +236,9 @@ impl BParticipant {
// closed // closed
if !closing_up && shutdown_send_mgr_receiver.try_recv().unwrap().is_some() { if !closing_up && shutdown_send_mgr_receiver.try_recv().unwrap().is_some() {
closing_up = true; closing_up = true;
//FIXME: quickfix for an error that we are WAITING on close confirmation of
// streams from prio manager while prio manager is already shut down.
async_std::task::sleep(TICK_TIME * 10).await;
} }
} }
trace!("Stop send_mgr"); trace!("Stop send_mgr");

View File

@ -15,6 +15,7 @@ use crossbeam_channel::{unbounded, Receiver, Sender};
use futures::channel::oneshot; use futures::channel::oneshot;
use std::collections::{HashMap, HashSet, VecDeque}; use std::collections::{HashMap, HashSet, VecDeque};
#[cfg(feature = "metrics")] use std::sync::Arc; #[cfg(feature = "metrics")] use std::sync::Arc;
use tracing::trace;
const PRIO_MAX: usize = 64; const PRIO_MAX: usize = 64;
@ -176,9 +177,11 @@ impl PrioManager {
if let Some(cnt) = self.sid_owned.get_mut(&sid) { if let Some(cnt) = self.sid_owned.get_mut(&sid) {
// register sender // register sender
cnt.empty_notify = Some(return_sender); cnt.empty_notify = Some(return_sender);
trace!(?sid, "register empty notify");
} else { } else {
// return immediately // return immediately
return_sender.send(()).unwrap(); return_sender.send(()).unwrap();
trace!(?sid, "return immediately that stream is empty");
} }
} }
} }
@ -249,6 +252,7 @@ impl PrioManager {
let cnt = self.sid_owned.remove(&sid).unwrap(); let cnt = self.sid_owned.remove(&sid).unwrap();
if let Some(empty_notify) = cnt.empty_notify { if let Some(empty_notify) = cnt.empty_notify {
empty_notify.send(()).unwrap(); empty_notify.send(()).unwrap();
trace!(?sid, "returned that stream is empty");
} }
} }
} else { } else {