fix cancellable future

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-12-13 12:10:04 +01:00
parent 8a1028e0e7
commit b5c9a706ce

View File

@ -61,7 +61,9 @@ impl Canceller {
/// ///
/// This does nothing if the future already finished successfully. /// This does nothing if the future already finished successfully.
pub fn cancel(&self) { pub fn cancel(&self) {
let _ = self.0.lock().unwrap().take().unwrap().send(()); if let Some(sender) = self.0.lock().unwrap().take() {
let _ = sender.send(());
}
} }
} }