Fix allocation of empty DhtNodes in TorrentSpec

https://github.com/anacrolix/torrent/pull/536#issuecomment-896392738
This commit is contained in:
Matt Joiner 2021-08-11 12:27:00 +10:00
parent 87294355fb
commit d03de7669b
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ func TorrentSpecFromMetaInfoErr(mi *metainfo.MetaInfo) (*TorrentSpec, error) {
DisplayName: info.Name, DisplayName: info.Name,
Webseeds: mi.UrlList, Webseeds: mi.UrlList,
DhtNodes: func() (ret []string) { DhtNodes: func() (ret []string) {
ret = make([]string, len(mi.Nodes)) ret = make([]string, 0, len(mi.Nodes))
for _, node := range mi.Nodes { for _, node := range mi.Nodes {
ret = append(ret, string(node)) ret = append(ret, string(node))
} }