From 40bb5e0a5468d0d92b50b0dbc379f86e2a28814f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=9CM=C3=9C=C5=9E?= <96421894+Tahinli@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:09:11 +0300 Subject: [PATCH] fix: progress increasing, instead of decreasing --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e4045f3..4823009 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,7 +85,6 @@ impl FileInfo if iteration != 0 { self.read_exact(&mut buffer, debug_mode); - println!("%{}", (iteration as f64/total_iteration as f64)*100 as f64); } else { @@ -96,6 +95,7 @@ impl FileInfo println!("Read Data = {:#?}", buffer); } self.send_exact(&mut buffer, stream, debug_mode); + println!("%{}", 100 as f64 -((iteration as f64/total_iteration as f64)*100 as f64)); } } fn handshake_validation(&mut self, stream:&mut TcpStream, size:u64, debug_mode:&bool) @@ -302,12 +302,12 @@ impl FileInfo if iteration != 0 { self.save_exact(&buffer, debug_mode); - println!("%{}", (iteration as f64/total_iteration as f64)*100 as f64); } else { self.save_exact(&buffer[..(size%BUFFER_SIZE) as usize], debug_mode); } + println!("%{}", 100 as f64 -((iteration as f64/total_iteration as f64)*100 as f64)); } } }