webtorrent logging improvements
This commit is contained in:
parent
93366bb63a
commit
05e448d132
|
@ -1320,11 +1320,13 @@ func (t *Torrent) startScrapingTracker(_url string) {
|
|||
wst := websocketTracker{*u, webtorrent.NewTrackerClient(t.cl.peerID, t.infoHash, t.onWebRtcConn,
|
||||
t.logger.WithText(func(m log.Msg) string {
|
||||
return fmt.Sprintf("%q: %v", u.String(), m.Text())
|
||||
}))}
|
||||
}).WithValues(log.Debug))}
|
||||
go func() {
|
||||
err := wst.TrackerClient.Run(t.announceRequest(tracker.Started), u.String())
|
||||
if err != nil {
|
||||
t.logger.WithValues(log.Error).Printf("error running websocket tracker announcer: %v", err)
|
||||
t.logger.WithValues(log.Error).Printf(
|
||||
"error running websocket tracker announcer for %q: %v",
|
||||
u.String(), err)
|
||||
}
|
||||
}()
|
||||
return wst
|
||||
|
|
|
@ -130,11 +130,11 @@ func (c *TrackerClient) trackerReadLoop() error {
|
|||
|
||||
var ar AnnounceResponse
|
||||
if err := json.Unmarshal(message, &ar); err != nil {
|
||||
log.Printf("error unmarshaling announce response: %v", err)
|
||||
c.logger.Printf("error unmarshaling announce response: %v", err)
|
||||
continue
|
||||
}
|
||||
if ar.InfoHash != c.infoHashBinary {
|
||||
log.Printf("announce response for different hash: expected %q got %q", c.infoHashBinary, ar.InfoHash)
|
||||
c.logger.Printf("announce response for different hash: expected %q got %q", c.infoHashBinary, ar.InfoHash)
|
||||
continue
|
||||
}
|
||||
switch {
|
||||
|
|
Loading…
Reference in New Issue