]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Wasn't using ChunkSize from TorrentSpec
authorMatt Joiner <anacrolix@gmail.com>
Mon, 9 May 2016 13:00:20 +0000 (23:00 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 9 May 2016 13:00:20 +0000 (23:00 +1000)
client.go

index 6201f3872ffce120e6ff06a711c8d5f41cc500b3..65259f493b95719b1c02850f31c626742c26ba45 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1556,25 +1556,22 @@ func (cl *Client) AddTorrentInfoHash(infoHash metainfo.Hash) (t *Torrent, new bo
 // provides one. Returns new if the torrent wasn't already in the client.
 func (cl *Client) AddTorrentSpec(spec *TorrentSpec) (t *Torrent, new bool, err error) {
        t, new = cl.AddTorrentInfoHash(spec.InfoHash)
-
        if spec.DisplayName != "" {
                t.SetDisplayName(spec.DisplayName)
        }
-
        if spec.Info != nil {
                err = t.SetInfoBytes(spec.Info.Bytes)
                if err != nil {
                        return
                }
        }
-
        cl.mu.Lock()
        defer cl.mu.Unlock()
-
+       if spec.ChunkSize != 0 {
+               t.chunkSize = pp.Integer(spec.ChunkSize)
+       }
        t.addTrackers(spec.Trackers)
-
        t.maybeNewConns()
-
        return
 }