From: Matt Joiner Date: Wed, 25 Mar 2015 04:50:31 +0000 (+1100) Subject: Show metadata state in status output X-Git-Tag: v1.0.0~1247 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=87690e4c4ca95b3f5f34f2f9a093494c57881b87;p=btrtrc.git Show metadata state in status output This is help verify the cause for an occasional stall obtaining metadata from peers. --- 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())