Should fix a race with Torrent.AddTrackers
type AnnounceList [][]string
+func (al AnnounceList) Clone() (ret AnnounceList) {
+ for _, tier := range al {
+ ret = append(ret, append([]string(nil), tier...))
+ }
+ return
+}
+
// Whether the AnnounceList should be preferred over a single URL announce.
func (al AnnounceList) OverridesAnnounce(announce string) bool {
for _, tier := range al {
CreationDate: time.Now().Unix(),
Comment: "dynamic metainfo from client",
CreatedBy: "go.torrent",
- AnnounceList: t.metainfo.UpvertedAnnounceList(),
+ AnnounceList: t.metainfo.UpvertedAnnounceList().Clone(),
InfoBytes: func() []byte {
if t.haveInfo() {
return t.metadataBytes