Fix locks around Torrent.announceRequest
This commit is contained in:
parent
05e448d132
commit
f90cbcce20
|
@ -1321,8 +1321,9 @@ func (t *Torrent) startScrapingTracker(_url string) {
|
|||
t.logger.WithText(func(m log.Msg) string {
|
||||
return fmt.Sprintf("%q: %v", u.String(), m.Text())
|
||||
}).WithValues(log.Debug))}
|
||||
ar := t.announceRequest(tracker.Started)
|
||||
go func() {
|
||||
err := wst.TrackerClient.Run(t.announceRequest(tracker.Started), u.String())
|
||||
err := wst.TrackerClient.Run(ar, u.String())
|
||||
if err != nil {
|
||||
t.logger.WithValues(log.Error).Printf(
|
||||
"error running websocket tracker announcer for %q: %v",
|
||||
|
|
|
@ -113,9 +113,9 @@ func (me *trackerScraper) announce(event tracker.AnnounceEvent) (ret trackerAnno
|
|||
ret.Err = fmt.Errorf("error getting ip: %s", err)
|
||||
return
|
||||
}
|
||||
me.t.cl.lock()
|
||||
me.t.cl.rLock()
|
||||
req := me.t.announceRequest(event)
|
||||
me.t.cl.unlock()
|
||||
me.t.cl.rUnlock()
|
||||
//log.Printf("announcing %s %s to %q", me.t, req.Event, me.u.String())
|
||||
res, err := tracker.Announce{
|
||||
HTTPProxy: me.t.cl.config.HTTPProxy,
|
||||
|
|
Loading…
Reference in New Issue