]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Merge pull request #410 from anacrolix/webseeds
authorMatt Joiner <anacrolix@gmail.com>
Wed, 3 Jun 2020 01:25:08 +0000 (11:25 +1000)
committerGitHub <noreply@github.com>
Wed, 3 Jun 2020 01:25:08 +0000 (11:25 +1000)
* Rename Peer to PeerInfo, and unexport PeerInfos

* Break peer out from PeerConn

* Abstract out segments mapping and use it in mmap storage

* Got file storage working with segment index

* Fix race in webtorrent.TrackerClient.Run

* storage file implementation: Error on short writes

* Remove debug logging from storage file implementation

* cmd/torrent-verify: Fix piece hash output

* Support disabling webtorrent

* Further progress on webseeding

* Handle webseed Client events

* Rename fastestConn->fastestPeer

* Add webseeds from magnet links

* Remove events from webseed

Manage this stuff inside the webseed peer instead.

* Make use of magnet source fields and expose Torrent.MergeSpec

* Add option to disable webseeds

* Fix webseeds when info isn't available immediately

* Handle webseed request errors

* Tidy up the interface changes

1  2 
peerconn.go
torrent.go

diff --cc peerconn.go
Simple merge
diff --cc torrent.go
index d231a8e54c6c77ceb1212ac38f3c82073a0b2f59,12402c5a83643445ab7bdbdbed5b949db9ed58ed..c2f936e2e2a41a08f4e9d357844d675ea9b3a2a2
@@@ -1967,32 -1983,11 +1987,31 @@@ func (t *Torrent) AllowDataDownload() 
        defer t.cl.unlock()
        log.Printf("AllowDataDownload")
        t.dataDownloadDisallowed = false
-       for c := range t.conns {
+       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()
 +      }
 +}
 +
  func (t *Torrent) SetOnWriteChunkError(f func(error)) {
        t.cl.lock()
        defer t.cl.unlock()