From 6cec96556761eedb4563147c96f498eb8910a30d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 24 Apr 2025 23:05:42 +1000 Subject: [PATCH] Add Request.String --- types/types.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/types.go b/types/types.go index df9284a5..63806705 100644 --- a/types/types.go +++ b/types/types.go @@ -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, -- 2.48.1