}
// The trackers will be merged with the existing ones. If the Info isn't yet known, it will be set.
+// spec.DisallowDataDownload/Upload will be read and applied
// The display name is replaced if the new spec provides one. Note that any `Storage` is ignored.
func (t *Torrent) MergeSpec(spec *TorrentSpec) error {
if spec.DisplayName != "" {
}
t.addTrackers(spec.Trackers)
t.maybeNewConns()
+ t.dataDownloadDisallowed = spec.DisallowDataDownload
+ t.dataUploadDisallowed = spec.DisallowDataUpload
return nil
}
// The chunk size to use for outbound requests. Defaults to 16KiB if not set.
ChunkSize int
Storage storage.ClientImpl
+
+ // Whether to allow data download or upload
+ DisallowDataUpload bool
+ DisallowDataDownload bool
}
func TorrentSpecFromMagnetURI(uri string) (spec *TorrentSpec, err error) {
}
func (t *Torrent) disallowDataDownloadLocked() {
- log.Printf("disallowing data download")
t.dataDownloadDisallowed = true
t.iterPeers(func(c *peer) {
c.updateRequests()
func (t *Torrent) AllowDataDownload() {
t.cl.lock()
defer t.cl.unlock()
- log.Printf("AllowDataDownload")
t.dataDownloadDisallowed = false
t.iterPeers(func(c *peer) {
c.updateRequests()
func (t *Torrent) AllowDataUpload() {
t.cl.lock()
defer t.cl.unlock()
- log.Printf("AllowDataUpload")
t.dataUploadDisallowed = false
for c := range t.conns {
c.updateRequests()
func (t *Torrent) DisallowDataUpload() {
t.cl.lock()
defer t.cl.unlock()
- log.Printf("DisallowDataUpload")
t.dataUploadDisallowed = true
for c := range t.conns {
c.updateRequests()