Skip to content

Commit 3786efd

Browse files
committed
[tfs] use http tracker only & limit max connections for every torrent
1 parent b36c8c2 commit 3786efd

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

params/trackers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var MainnetTrackers = []string{
3535
//"http://dht.cortexlabs.ai:5008/announce",
3636
"http://127.0.0.1:5008/announce",
3737

38-
"udp://47.91.91.217:5008/announce",
38+
/*"udp://47.91.91.217:5008/announce",
3939
"udp://47.74.1.234:5008/announce",
4040
"udp://47.88.7.24:5008/announce",
4141
"udp://47.91.43.70:5008/announce",
@@ -61,7 +61,7 @@ var MainnetTrackers = []string{
6161
"ws://torrent.cortexlabs.ai:5008/announce",
6262
//"ws://dht.coinbag.org:5008/announce",
6363
//"ws://dht.cortexlabs.ai:5008/announce",
64-
"ws://127.0.0.1:5008/announce",
64+
"ws://127.0.0.1:5008/announce",*/
6565
}
6666

6767
var BernardTrackers = []string{

torrentfs/monitor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ func (m *Monitor) peers() ([]*p2p.PeerInfo, error) {
211211
}
212212
m.trackerLock.Lock()
213213
trackers = append(trackers, tracker)
214-
trackers = append(trackers, m.udp_tracker_build(ip, p)) //"udp://" + ip + ":" + p + "/announce")
215-
trackers = append(trackers, m.ws_tracker_build(ip, p)) //"ws://" + ip + ":" + p + "/announce")
214+
//trackers = append(trackers, m.udp_tracker_build(ip, p)) //"udp://" + ip + ":" + p + "/announce")
215+
//trackers = append(trackers, m.ws_tracker_build(ip, p)) //"ws://" + ip + ":" + p + "/announce")
216216
m.trackerLock.Unlock()
217217
flush = true
218218
healthPeers.Add(tracker, peer)
@@ -577,7 +577,7 @@ func (m *Monitor) listenPeers() {
577577
m.peers()
578578
if healthPeers.Len() == 0 {
579579
timer.Reset(time.Second * 5)
580-
} else if healthPeers.Len() < 10 {
580+
} else if healthPeers.Len() < 6 {
581581
timer.Reset(time.Second * 60)
582582
} else {
583583
timer.Reset(time.Second * 300)

torrentfs/torrentClient.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ func NewTorrentManager(config *Config) *TorrentManager {
551551
//cfg.SetListenAddr(listenAddr.String())
552552
cfg.HTTPUserAgent = "Cortex"
553553
cfg.Seed = true
554-
//cfg.EstablishedConnsPerTorrent = 10
555-
//cfg.HalfOpenConnsPerTorrent = 5
554+
cfg.EstablishedConnsPerTorrent = 2
555+
cfg.HalfOpenConnsPerTorrent = 1
556556
cfg.ListenPort = 0
557557
//cfg.DropDuplicatePeerIds = true
558558
log.Info("Torrent client configuration", "config", cfg)

0 commit comments

Comments
 (0)