Skip to content

Commit

Permalink
add ClearTrackers() func
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed May 23, 2024
1 parent a9a5af5 commit 2b5fb4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions t.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ func (t *Torrent) AddTrackers(announceList [][]string) {
t.addTrackers(announceList)
}

func (t *Torrent) ClearTrackers() {
t.cl.lock()
defer t.cl.unlock()
t.clearTrackers()
}

func (t *Torrent) Piece(i pieceIndex) *Piece {
return t.piece(i)
}
Expand Down
4 changes: 4 additions & 0 deletions torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,10 @@ func (t *Torrent) addTrackers(announceList [][]string) {
t.updateWantPeersEvent()
}

func (t *Torrent) clearTrackers() {
clear(t.metainfo.AnnounceList)
}

// Don't call this before the info is available.
func (t *Torrent) bytesCompleted() int64 {
if !t.haveInfo() {
Expand Down
2 changes: 1 addition & 1 deletion webseed/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ func readRequestPartResponses(ctx context.Context, parts []requestPart) (_ []byt
}
}
return buf.Bytes(), err
}
}

0 comments on commit 2b5fb4d

Please sign in to comment.