Skip to content
Merged

Dev #328

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fi
function start_cvm(){
#./cvm.sh | grep -v 'Terminated ' & #>/dev/null 2>&1 &
#echo $$ > cvm.pid
./cvm.sh 2>/dev/null &
./cvm.sh & #2>/dev/null &
echo $! > ${cvm_pid}
chmod 644 "${cvm_pid}"
}
Expand Down
3 changes: 3 additions & 0 deletions torrentfs/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ func (m *Monitor) Stop() {
close(m.exitCh)
log.Info("Monitor is waiting to be closed")
m.wg.Wait()

m.blockCache.Purge()
m.sizeCache.Purge()
/*m.wg.Add(1)
m.closeOnce.Do(func() {
defer m.wg.Done()
Expand Down
15 changes: 8 additions & 7 deletions torrentfs/torrentClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ func (t *Torrent) Seed() {
if t.Torrent.Seeding() {
t.status = torrentSeeding
elapsed := time.Duration(mclock.Now()) - time.Duration(t.start)
log.Info("Download success", "hash", t.InfoHash(), "size", common.StorageSize(t.BytesCompleted()), "files", len(t.Files()), "pieces", t.Torrent.NumPieces(), "seg", len(t.Torrent.PieceStateRuns()), "cited", t.cited, "conn", t.currentConns, "elapsed", elapsed)
log.Info("Finish downloading", "hash", t.InfoHash(), "elapsed", elapsed)
//log.Info("Download success", "hash", t.InfoHash(), "size", common.StorageSize(t.BytesCompleted()), "files", len(t.Files()), "pieces", t.Torrent.NumPieces(), "seg", len(t.Torrent.PieceStateRuns()), "cited", t.cited, "conn", t.currentConns, "elapsed", elapsed)
//t.Torrent.Drop()
} else {
//t.Torrent.DownloadAll()
Expand Down Expand Up @@ -476,7 +477,7 @@ func (tm *TorrentManager) SetTorrent(ih metainfo.Hash, torrent *Torrent) {
tm.torrents[ih] = torrent
tm.lock.Unlock()
tm.pendingChan <- torrent
log.Info("P <- B", "hash", ih)
log.Debug("P <- B", "hash", ih)
}

func (tm *TorrentManager) Close() error {
Expand Down Expand Up @@ -784,7 +785,7 @@ func NewTorrentManager(config *Config, fsid uint64) *TorrentManager {
// "max_activenum", config.MaxActiveNum,
// )
cfg := torrent.NewDefaultClientConfig()
//cfg.DisableUTP = config.DisableUTP
cfg.DisableUTP = config.DisableUTP
cfg.NoDHT = config.DisableDHT
cfg.DisableTCP = config.DisableTCP

Expand Down Expand Up @@ -990,10 +991,10 @@ func (tm *TorrentManager) pendingTorrentLoop() {
if t.Torrent.Info() != nil {
if t.start == 0 {
if t.isBoosting {
log.Info("A <- P (BOOST)", "hash", ih, "pieces", t.Torrent.NumPieces(), "boost", t.isBoosting)
log.Info("A <- P (BOOST)", "hash", ih, "boost", t.isBoosting)
t.isBoosting = false
} else {
log.Info("A <- P (UDP)", "hash", ih, "pieces", t.Torrent.NumPieces(), "boost", t.isBoosting)
log.Info("A <- P (UDP)", "hash", ih, "boost", t.isBoosting)
}
t.AddTrackers(tm.trackers)
t.start = mclock.Now()
Expand Down Expand Up @@ -1161,7 +1162,7 @@ func (tm *TorrentManager) activeTorrentLoop() {
if len(tm.seedingChan) < cap(tm.seedingChan) {
log.Debug("Path exist", "hash", ih, "path", path.Join(tm.DataDir, ih.String()))
delete(tm.activeTorrents, ih)
log.Info("S <- A", "hash", ih) //, "elapsed", time.Duration(mclock.Now())-time.Duration(t.start))
log.Debug("S <- A", "hash", ih) //, "elapsed", time.Duration(mclock.Now())-time.Duration(t.start))
//t.start = mclock.Now()
tm.seedingChan <- t
}
Expand All @@ -1180,7 +1181,7 @@ func (tm *TorrentManager) activeTorrentLoop() {
} else {
if len(tm.seedingChan) < cap(tm.seedingChan) {
delete(tm.activeTorrents, ih)
log.Info("S <- A", "hash", ih) //, "elapsed", time.Duration(mclock.Now())-time.Duration(t.start))
log.Debug("S <- A", "hash", ih) //, "elapsed", time.Duration(mclock.Now())-time.Duration(t.start))
//t.start = mclock.Now()
tm.seedingChan <- t
}
Expand Down
1 change: 1 addition & 0 deletions torrentfs/torrentfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (tfs *TorrentFS) Stop() error {
}
// Wait until every goroutine terminates.
tfs.monitor.Stop()
tfs.fileCache.Purge()
return nil
}

Expand Down
36 changes: 17 additions & 19 deletions vendor/github.com/anacrolix/torrent/connection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/anacrolix/torrent/tracker/http.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.