]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Set ConnectionIdMismatchNul error default log level to debug
authorMatt Joiner <anacrolix@gmail.com>
Mon, 30 Sep 2024 02:13:59 +0000 (12:13 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 30 Sep 2024 02:16:08 +0000 (12:16 +1000)
tracker/udp/client.go

index 44d051371922859a3fa9d6116610ab47e988e799..91625380ccfdd34e961b4d43c30561e851de109e 100644 (file)
@@ -10,6 +10,7 @@ import (
        "time"
 
        "github.com/anacrolix/dht/v2/krpc"
+       "github.com/anacrolix/log"
        "github.com/protolambda/ctxlock"
 )
 
@@ -224,7 +225,11 @@ func (cl *Client) request(
                } else if dr.Header.Action == ActionError {
                        // udp://tracker.torrent.eu.org:451/announce frequently returns "Connection ID
                        // missmatch.\x00"
-                       err = ErrorResponse{Message: string(dr.Body)}
+                       stringBody := string(dr.Body)
+                       err = ErrorResponse{Message: stringBody}
+                       if stringBody == ConnectionIdMissmatchNul {
+                               err = log.WithLevel(log.Debug, err)
+                       }
                        // Force a reconnection. Probably any error is worth doing this for, but the one we're
                        // specifically interested in is ConnectionIdMissmatchNul.
                        cl.connIdIssued = time.Time{}