protocol: cleanup finish_backup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
b238851832
commit
6f90a6a764
@ -587,17 +587,17 @@ where
|
|||||||
self.common.queue_data(packet.finish())
|
self.common.queue_data(packet.finish())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish_backup(&mut self, stream: BackupStream) -> Result<(StreamId, String, bool)> {
|
pub fn finish_backup(&mut self, stream: BackupStream) -> Result<(String, bool)> {
|
||||||
let path = self
|
let path = self
|
||||||
.streams
|
.streams
|
||||||
.remove(&stream.0)
|
.remove(&stream.0)
|
||||||
.ok_or_else(|| format_err!("no such active backup stream"))?
|
.ok_or_else(|| format_err!("no such active backup stream"))?
|
||||||
.path
|
.path
|
||||||
.unwrap_or_else(|| "<no remote name received>".to_string());
|
.unwrap_or_else(|| "<no remote name received>".to_string());
|
||||||
let ack = self
|
let done = self
|
||||||
.common
|
.common
|
||||||
.queue_data(Packet::simple(stream.0, PacketType::BackupFinished))?;
|
.queue_data(Packet::simple(stream.0, PacketType::BackupFinished))?;
|
||||||
self.expect_ok_for_id(stream.0);
|
self.expect_ok_for_id(stream.0);
|
||||||
Ok((StreamId(stream.0), path, ack))
|
Ok((path, done))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,9 +240,10 @@ impl<S: AsyncRead + AsyncWrite> UploaderBase<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish_backup(&mut self, stream: BackupStream) -> Result<(), Error> {
|
pub fn finish_backup(&mut self, stream: BackupStream) -> Result<(), Error> {
|
||||||
let (ack, name, _done) = self.client.as_mut().unwrap().finish_backup(stream)?;
|
let id = stream.into();
|
||||||
|
let (name, _done) = self.client.as_mut().unwrap().finish_backup(stream)?;
|
||||||
println!("Server created file: {}", name);
|
println!("Server created file: {}", name);
|
||||||
self.wait_id = Some(ack);
|
self.wait_id = Some(id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user