From: Matt Joiner Date: Wed, 3 Jun 2020 01:25:08 +0000 (+1000) Subject: Merge pull request #410 from anacrolix/webseeds X-Git-Tag: v1.16.0~16 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=86063859850cf1288a2773fc7c7a0c646513d597;p=btrtrc.git Merge pull request #410 from anacrolix/webseeds * 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 --- 86063859850cf1288a2773fc7c7a0c646513d597 diff --cc torrent.go index d231a8e5,12402c5a..c2f936e2 --- a/torrent.go +++ b/torrent.go @@@ -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()