Merge branch 'xMAC94x/login_quickfix' into 'master'

Drop is run only AFTER each statement.

See merge request veloren/veloren!1557
This commit is contained in:
Marcel 2020-11-25 23:01:23 +00:00
commit 42201e6a2a

View File

@ -270,7 +270,9 @@ impl Scheduler {
// 3. Participant will try to access the BParticipant senders and receivers with
// their next api action, it will fail and be closed then.
trace!(?pid, "Got request to close participant");
if let Some(mut pi) = self.participants.lock().await.remove(&pid) {
let pi = self.participants.lock().await.remove(&pid);
trace!(?pid, "dropped participants lock");
if let Some(mut pi) = pi {
let (finished_sender, finished_receiver) = oneshot::channel();
pi.s2b_shutdown_bparticipant_s
.take()
@ -278,8 +280,9 @@ impl Scheduler {
.send(finished_sender)
.unwrap();
drop(pi);
trace!("dropped bparticipant, waiting for finish");
trace!(?pid, "dropped bparticipant, waiting for finish");
let e = finished_receiver.await.unwrap();
trace!(?pid, "waiting completed");
return_once_successful_shutdown.send(e).unwrap();
} else {
debug!(?pid, "Looks like participant is already dropped");