]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add Request.String
authorMatt Joiner <anacrolix@gmail.com>
Thu, 24 Apr 2025 13:05:42 +0000 (23:05 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 24 Apr 2025 13:08:39 +0000 (23:08 +1000)
types/types.go

index df9284a54ea543742709506586d5f1c0b390657a..63806705f501d1b31b572c486c68e87d83a06995 100644 (file)
@@ -3,6 +3,7 @@
 package types
 
 import (
+       "fmt"
        pp "github.com/anacrolix/torrent/peer_protocol"
 )
 
@@ -17,6 +18,10 @@ type Request struct {
        ChunkSpec
 }
 
+func (r Request) String() string {
+       return fmt.Sprintf("piece %v, %v bytes at %v", r.Index, r.Length, r.Begin)
+}
+
 func (r Request) ToMsg(mt pp.MessageType) pp.Message {
        return pp.Message{
                Type:   mt,