From 87690e4c4ca95b3f5f34f2f9a093494c57881b87 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 25 Mar 2015 15:50:31 +1100 Subject: [PATCH] Show metadata state in status output This is help verify the cause for an occasional stall obtaining metadata from peers. --- torrent.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/torrent.go b/torrent.go index 0f302c72..056ad80f 100644 --- a/torrent.go +++ b/torrent.go @@ -467,6 +467,18 @@ func (t *torrent) pieceStatusCharSequences() (ret []PieceStatusCharSequence) { func (t *torrent) writeStatus(w io.Writer) { fmt.Fprintf(w, "Infohash: %x\n", t.InfoHash) + fmt.Fprintf(w, "Metadata length: %d\n", t.metadataSize()) + fmt.Fprintf(w, "Metadata have: ") + for _, h := range t.metadataHave { + fmt.Fprintf(w, "%c", func() rune { + if h { + return 'H' + } else { + return '.' + } + }()) + } + fmt.Fprintln(w) fmt.Fprintf(w, "Piece length: %s\n", func() string { if t.haveInfo() { return fmt.Sprint(t.usualPieceSize()) -- 2.48.1