From 48871324f4bbe0c8a88eb14e4088576424888ed4 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 7 Apr 2016 19:13:51 +1000 Subject: [PATCH] Comments and logs around bad metadata size --- torrent.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/torrent.go b/torrent.go index 12c365d6..a54a9a12 100644 --- a/torrent.go +++ b/torrent.go @@ -289,13 +289,14 @@ func (t *Torrent) haveAllMetadataPieces() bool { return true } +// TODO: Propagate errors to disconnect peer. func (t *Torrent) setMetadataSize(bytes int64, cl *Client) { if t.haveInfo() { // We already know the correct metadata size. return } if bytes <= 0 || bytes > 10000000 { // 10MB, pulled from my ass. - log.Printf("received bad metadata size: %d", bytes) + log.Printf("%s: received bad metadata size: %d", t, bytes) return } if t.metadataBytes != nil && len(t.metadataBytes) == int(bytes) { -- 2.48.1