Add AddTorrentOpts.InfoBytes
This commit is contained in:
parent
8d3e86e3c0
commit
069b92a98c
|
@ -1259,9 +1259,8 @@ func (cl *Client) AddTorrentInfoHashWithStorage(infoHash metainfo.Hash, specStor
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds a torrent by InfoHash with a custom Storage implementation.
|
// Adds a torrent by InfoHash with a custom Storage implementation. If the torrent already exists
|
||||||
// If the torrent already exists then this Storage is ignored and the
|
// then this Storage is ignored and the existing torrent returned with `new` set to `false`.
|
||||||
// existing torrent returned with `new` set to `false`
|
|
||||||
func (cl *Client) AddTorrentOpt(opts AddTorrentOpts) (t *Torrent, new bool) {
|
func (cl *Client) AddTorrentOpt(opts AddTorrentOpts) (t *Torrent, new bool) {
|
||||||
infoHash := opts.InfoHash
|
infoHash := opts.InfoHash
|
||||||
cl.lock()
|
cl.lock()
|
||||||
|
@ -1279,6 +1278,7 @@ func (cl *Client) AddTorrentOpt(opts AddTorrentOpts) (t *Torrent, new bool) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
cl.torrents[infoHash] = t
|
cl.torrents[infoHash] = t
|
||||||
|
t.setInfoBytesLocked(opts.InfoBytes)
|
||||||
cl.clearAcceptLimits()
|
cl.clearAcceptLimits()
|
||||||
t.updateWantPeersEvent()
|
t.updateWantPeersEvent()
|
||||||
// Tickle Client.waitAccept, new torrent may want conns.
|
// Tickle Client.waitAccept, new torrent may want conns.
|
||||||
|
@ -1290,6 +1290,7 @@ type AddTorrentOpts struct {
|
||||||
InfoHash infohash.T
|
InfoHash infohash.T
|
||||||
Storage storage.ClientImpl
|
Storage storage.ClientImpl
|
||||||
ChunkSize pp.Integer
|
ChunkSize pp.Integer
|
||||||
|
InfoBytes []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add or merge a torrent spec. Returns new if the torrent wasn't already in the client. See also
|
// Add or merge a torrent spec. Returns new if the torrent wasn't already in the client. See also
|
||||||
|
|
Loading…
Reference in New Issue