This commit is contained in:
yourok
2019-12-17 10:47:06 +03:00
parent c1cafa62a2
commit 7596a530af

View File

@@ -6,7 +6,6 @@ import (
"sort"
"sync"
"time"
"fmt"
"server/settings"
"server/utils"
@@ -185,7 +184,7 @@ func (t *Torrent) progressEvent() {
}
t.muTorrent.Unlock()
t.lastTimeSpeed = time.Now()
if (t.BytesReadUsefulData > settings.Get().PreloadBufferSize) {
if t.BytesReadUsefulData > settings.Get().PreloadBufferSize {
adj := int64((int(t.cache.GetState().PiecesLength) * t.Torrent.Stats().ActivePeers) / (1 + t.cache.ReadersLen()))
switch {
case adj < t.cache.GetState().PiecesLength:
@@ -194,7 +193,7 @@ func (t *Torrent) progressEvent() {
adj = t.cache.GetState().PiecesLength * 4
}
t.cache.AdjustRA(adj)
log.Println("Status:", t.Name(), "S:", fmt.Sprintf("%8s", utils.Format(t.DownloadSpeed)), "P:", fmt.Sprintf("%2d", t.Torrent.Stats().ActivePeers), "/", fmt.Sprintf("%2d", t.Torrent.Stats().TotalPeers), "R:", t.cache.ReadersLen(), "RA:", utils.Format(float64(adj)))
//log.Println("Status:", t.Name(), "S:", fmt.Sprintf("%8s", utils.Format(t.DownloadSpeed)), "P:", fmt.Sprintf("%2d", t.Torrent.Stats().ActivePeers), "/", fmt.Sprintf("%2d", t.Torrent.Stats().TotalPeers), "R:", t.cache.ReadersLen(), "RA:", utils.Format(float64(adj)))
}
}