]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Reuse the info bytes when marshalling torrent metainfo
authorMatt Joiner <anacrolix@gmail.com>
Tue, 2 Dec 2014 05:33:38 +0000 (23:33 -0600)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 2 Dec 2014 05:33:38 +0000 (23:33 -0600)
torrent.go

index 5d13d6a91326bb3cd3d53e8b4852dea21f40e01f..8e909a0984660ce7def09c2390f01dd2d581be96 100644 (file)
@@ -370,9 +370,13 @@ func (t *torrent) AnnounceList() (al [][]string) {
 }
 
 func (t *torrent) MetaInfo() *metainfo.MetaInfo {
+       if t.MetaData == nil {
+               panic("info bytes not set")
+       }
        return &metainfo.MetaInfo{
                Info: metainfo.InfoEx{
-                       Info: *t.Info.Info,
+                       Info:  *t.Info.Info,
+                       Bytes: t.MetaData,
                },
                CreationDate: time.Now().Unix(),
                Comment:      "dynamic metainfo from client",