Print average download rate
This commit is contained in:
parent
181cbd3e52
commit
89e7e00c31
|
@ -347,6 +347,7 @@ func downloadErr(flags downloadFlags) error {
|
||||||
client.WriteStatus(w)
|
client.WriteStatus(w)
|
||||||
})
|
})
|
||||||
err = addTorrents(client, flags)
|
err = addTorrents(client, flags)
|
||||||
|
started := time.Now()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("adding torrents: %w", err)
|
return fmt.Errorf("adding torrents: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -356,6 +357,13 @@ func downloadErr(flags downloadFlags) error {
|
||||||
} else {
|
} else {
|
||||||
err = errors.New("y u no complete torrents?!")
|
err = errors.New("y u no complete torrents?!")
|
||||||
}
|
}
|
||||||
|
clientConnStats := client.ConnStats()
|
||||||
|
log.Printf("average download rate: %v",
|
||||||
|
humanize.Bytes(uint64(
|
||||||
|
time.Duration(
|
||||||
|
clientConnStats.BytesReadUsefulData.Int64(),
|
||||||
|
)*time.Second/time.Since(started),
|
||||||
|
)))
|
||||||
if flags.Seed {
|
if flags.Seed {
|
||||||
if len(client.Torrents()) == 0 {
|
if len(client.Torrents()) == 0 {
|
||||||
log.Print("no torrents to seed")
|
log.Print("no torrents to seed")
|
||||||
|
|
Loading…
Reference in New Issue