Skip to content

Commit

Permalink
remove print hash rate
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Jul 18, 2024
1 parent d2569e7 commit 2e470b5
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions t.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package torrent

import (
"context"
"fmt"
"runtime"
"strconv"
"strings"
"sync/atomic"
"time"

"github.com/anacrolix/chansync/events"
Expand Down Expand Up @@ -217,8 +215,6 @@ func (t *Torrent) DownloadPieces(begin, end pieceIndex) {

t.disallowDataDownload(true)

name := t.Name()

mu := sync.RWMutex{}
changes := map[pieceIndex]struct{}{}
haveTrigger := false
Expand All @@ -234,15 +230,6 @@ func (t *Torrent) DownloadPieces(begin, end pieceIndex) {
g.SetLimit(maxInt(runtime.NumCPU()*2-1, t.cl.config.PieceHashersPerTorrent/2))
defer cancel()

fmt.Println("DL", name, "hashers", maxInt(runtime.NumCPU()*2-1, t.cl.config.PieceHashersPerTorrent/2))

var hashed atomic.Int64
var complete atomic.Int64
start := time.Now()
defer func() {
fmt.Println("DL", name, "DONE", "C:", complete.Load(), "H:", hashed.Load(), "HR:", float64(hashed.Load())/time.Since(start).Seconds())
}()

for i := begin; i < end; i++ {
t.mu.RLock()
piece := &t.pieces[i]
Expand All @@ -255,7 +242,6 @@ func (t *Torrent) DownloadPieces(begin, end pieceIndex) {
storage := piece.Storage()

if completion.Complete {
complete.Add(int64(piece.length(true)))
return nil
}

Expand All @@ -264,7 +250,6 @@ func (t *Torrent) DownloadPieces(begin, end pieceIndex) {
mu.RUnlock()

if checkCompletion && !storage.IsNew() {
hashed.Add(int64(piece.length(true)))
if sum, _, err := t.hashPiece(piece); err == nil && sum == *piece.hash {
storage.MarkComplete(false)
t.updatePieceCompletion(piece.index, true)
Expand Down

0 comments on commit 2e470b5

Please sign in to comment.