Fix race in webtorrent.TrackerClient.Run

This commit is contained in:
Matt Joiner 2020-06-01 11:11:41 +10:00
parent 69a0f2f1e4
commit c3696aa5a4
1 changed files with 2 additions and 0 deletions

View File

@ -92,9 +92,11 @@ func (tc *TrackerClient) Run() error {
tc.mu.Unlock()
err := tc.doWebsocket()
level := log.Info
tc.mu.Lock()
if tc.closed {
level = log.Debug
}
tc.mu.Unlock()
tc.Logger.WithDefaultLevel(level).Printf("websocket instance ended: %v", err)
time.Sleep(time.Minute)
tc.mu.Lock()