diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index 5d5b85e7..7e590972 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -476,7 +476,6 @@ fn create_backup( } client.finish().wait()?; - client.force_close(); let end_time = Local.timestamp(Local::now().timestamp(), 0); let elapsed = end_time.signed_duration_since(backup_time); diff --git a/src/client/http_client.rs b/src/client/http_client.rs index 1cd8a091..c810d2f1 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -428,10 +428,6 @@ impl BackupClient { } } - pub fn force_close(mut self) { - self.canceller.take().unwrap().cancel(); - } - pub fn get(&self, path: &str, param: Option) -> impl Future { self.h2.get(path, param) } @@ -444,8 +440,16 @@ impl BackupClient { self.h2.post(path, param) } - pub fn finish(&self) -> impl Future { - self.h2.clone().post("finish", None).map(|_| ()) + pub fn finish(mut self) -> impl Future { + let canceler = self.canceller.take().unwrap(); + self.h2.clone().post("finish", None).map(move |_| { + canceler.cancel(); + () + }) + } + + pub fn force_close(mut self) { + self.canceller.take().unwrap().cancel(); } pub fn upload_config>(