Skip to content

Commit

Permalink
Merge pull request #43 from genonullfree/41-bug/truncate
Browse files Browse the repository at this point in the history
Truncate/extend file to correct size on overwrite
Closes #41
  • Loading branch information
genonullfree authored Oct 29, 2021
2 parents 2acb2ca + 32d919f commit 553b235
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "teleporter"
version = "0.5.0"
version = "0.5.1"
authors = ["geno nullfree <[email protected]>"]
license = "BSD-3-Clause"
description = "A small utility to send files quickly from point A to point B"
Expand Down
2 changes: 2 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ fn recv(mut stream: TcpStream, recv_list: Arc<Mutex<Vec<String>>>) -> Result<(),

// If overwrite and file exists, build TeleportDelta
let mut chunk_size = 5120;
file.set_len(header.filesize)?;
if meta.len() > 0 {
resp = TeleportInitAck::new(TeleportInitStatus::Overwrite);
resp.delta = match utils::calc_delta_hash(&file) {
Ok(d) => {
chunk_size = d.delta_size + 1024;
Expand Down

0 comments on commit 553b235

Please sign in to comment.