Skip to content

Commit

Permalink
Make sure we use lock_owned
Browse files Browse the repository at this point in the history
  • Loading branch information
MTRNord committed Nov 4, 2023
1 parent 7f990da commit f97d97d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/erooster_smtp/src/servers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub async fn start(
});

loop {
let mut receiver_lock = receiver.lock().await;
let mut receiver_lock = receiver.clone().lock_owned().await;
let data = receiver_lock.recv().await;

match data {
Expand Down Expand Up @@ -150,6 +150,10 @@ pub async fn start(

async fn cleanup(receiver: Arc<Mutex<Receiver>>) {
info!("Received ctr-c. Cleaning up");
receiver.lock().await.save().expect("Unable to save queue");
receiver
.lock_owned()
.await
.save()
.expect("Unable to save queue");
exit(0);
}

0 comments on commit f97d97d

Please sign in to comment.