]> Sergey Matveev's repositories - btrtrc.git/blobdiff - wstracker.go
Remove relevant webtorrent offers when closing Torrent
[btrtrc.git] / wstracker.go
index 5338ceb913da7644b2d0db1623b8355799a0d38b..e8bde8c348c8a7ba36106ed1ae11e8f1f77d9702 100644 (file)
@@ -42,7 +42,7 @@ type websocketTrackers struct {
        Proxy              http.ProxyFunc
 }
 
-func (me *websocketTrackers) Get(url string) (*webtorrent.TrackerClient, func()) {
+func (me *websocketTrackers) Get(url string, infoHash [20]byte) (*webtorrent.TrackerClient, func()) {
        me.mu.Lock()
        defer me.mu.Unlock()
        value, ok := me.clients[url]
@@ -74,6 +74,7 @@ func (me *websocketTrackers) Get(url string) (*webtorrent.TrackerClient, func())
        return &value.TrackerClient, func() {
                me.mu.Lock()
                defer me.mu.Unlock()
+               value.TrackerClient.CloseOffersForInfohash(infoHash)
                value.refCount--
                if value.refCount == 0 {
                        value.TrackerClient.Close()