From 7596a530af5b0aa781c92c41c4bd8a23fe7b29ce Mon Sep 17 00:00:00 2001 From: yourok <8yourok8@mail.ru> Date: Tue, 17 Dec 2019 10:47:06 +0300 Subject: [PATCH] fmt --- src/server/torr/Torrent.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/server/torr/Torrent.go b/src/server/torr/Torrent.go index a10de68..c9aaf4f 100644 --- a/src/server/torr/Torrent.go +++ b/src/server/torr/Torrent.go @@ -6,7 +6,6 @@ import ( "sort" "sync" "time" - "fmt" "server/settings" "server/utils" @@ -185,16 +184,16 @@ 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: - adj = t.cache.GetState().PiecesLength - case adj > t.cache.GetState().PiecesLength * 4: - adj = t.cache.GetState().PiecesLength * 4 + case adj < t.cache.GetState().PiecesLength: + adj = t.cache.GetState().PiecesLength + case adj > t.cache.GetState().PiecesLength*4: + 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))) } }