Skip to content

Commit 3df08fd

Browse files
committed
torrent/client hotfix for seeding torrent
1 parent eb59ba1 commit 3df08fd

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

torrentfs/torrentClient.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"crypto/sha1"
66
//"errors"
77
"fmt"
8-
//"github.com/anacrolix/missinggo/slices"
8+
"github.com/anacrolix/missinggo/slices"
99
"github.com/bradfitz/iter"
1010
"github.com/edsrzf/mmap-go"
1111
"io"
@@ -495,9 +495,9 @@ func (tm *TorrentManager) AddTorrent(filePath string, BytesRequested int64) *Tor
495495
if err != nil {
496496
return nil
497497
}
498-
//var ss []string
499-
//slices.MakeInto(&ss, mi.Nodes)
500-
//tm.client.AddDHTNodes(ss)
498+
var ss []string
499+
slices.MakeInto(&ss, mi.Nodes)
500+
tm.client.AddDHTNodes(ss)
501501
<-t.GotInfo()
502502
t.VerifyData()
503503
torrent := tm.CreateTorrent(t, BytesRequested, torrentPending, ih)
@@ -512,9 +512,9 @@ func (tm *TorrentManager) AddTorrent(filePath string, BytesRequested int64) *Tor
512512
if err != nil {
513513
return nil
514514
}
515-
//var ss []string
516-
//slices.MakeInto(&ss, mi.Nodes)
517-
//tm.client.AddDHTNodes(ss)
515+
var ss []string
516+
slices.MakeInto(&ss, mi.Nodes)
517+
tm.client.AddDHTNodes(ss)
518518
<-t.GotInfo()
519519
t.VerifyData()
520520
torrent := tm.CreateTorrent(t, BytesRequested, torrentPending, ih)
@@ -825,18 +825,16 @@ func (tm *TorrentManager) listenTorrentProgress() {
825825
t.bytesMissing = t.BytesMissing()
826826

827827
if t.Finished() {
828-
err := os.Symlink(
828+
os.Symlink(
829829
path.Join(defaultTmpFilePath, t.InfoHash()),
830830
path.Join(tm.DataDir, t.InfoHash()),
831831
)
832-
if err == nil {
833-
delete(tm.activeTorrents, ih)
834-
tm.seedingTorrents[ih] = t
835-
t.Seed()
836-
t.loop = defaultSeedInterval / queryTimeInterval
837-
total_size += uint64(t.bytesCompleted)
838-
current_size += uint64(t.bytesCompleted)
839-
}
832+
delete(tm.activeTorrents, ih)
833+
tm.seedingTorrents[ih] = t
834+
t.Seed()
835+
t.loop = defaultSeedInterval / queryTimeInterval
836+
total_size += uint64(t.bytesCompleted)
837+
current_size += uint64(t.bytesCompleted)
840838
continue
841839
}
842840

0 commit comments

Comments
 (0)