Attempted to add speed indicator on both sender and receiver (untested)
This commit is contained in:
parent
f5caf49c92
commit
93d5806e49
1 changed files with 4 additions and 2 deletions
|
@ -411,7 +411,8 @@ pub fn sender<F: Fn(f32)>(args: &Vec<String>, on_progress: F) {
|
|||
sc.write_safe(&buf[..read]).expect("send error");
|
||||
bytes_sent += read as u64;
|
||||
if (bytes_sent % (br * 20) as u64) < (br as u64) {
|
||||
print!("\r\x1b[KSent {} bytes", bytes_sent);
|
||||
print!("\r\x1b[KSent {} bytes; Speed: {} kb/s",
|
||||
bytes_sent, (read / 1000) / last_update as usize );
|
||||
stdout().flush().unwrap();
|
||||
}
|
||||
if unix_millis() - last_update > 100 {
|
||||
|
@ -478,7 +479,8 @@ pub fn receiver<F: Fn(f32)>(args: &Vec<String>, on_progress: F) {
|
|||
file.flush().expect("file flush error");
|
||||
bytes_received += amount as u64;
|
||||
if (bytes_received % (br * 20) as u64) < (br as u64) {
|
||||
print!("\r\x1b[KReceived {} bytes", bytes_received);
|
||||
print!("\r\x1b[KSent {} bytes; Speed: {} kb/s",
|
||||
bytes_sent, (read / 1000) / last_update as usize );
|
||||
stdout().flush().unwrap();
|
||||
}
|
||||
if unix_millis() - last_update > 100 {
|
||||
|
|
Loading…
Add table
Reference in a new issue