2
0
mirror of synced 2025-02-24 06:38:14 +00:00

Show metadata state in status output

This is help verify the cause for an occasional stall obtaining metadata from peers.
This commit is contained in:
Matt Joiner 2015-03-25 15:50:31 +11:00
parent 6da805d1b1
commit 87690e4c4c

View File

@ -467,6 +467,18 @@ func (t *torrent) pieceStatusCharSequences() (ret []PieceStatusCharSequence) {
func (t *torrent) writeStatus(w io.Writer) { func (t *torrent) writeStatus(w io.Writer) {
fmt.Fprintf(w, "Infohash: %x\n", t.InfoHash) 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 { fmt.Fprintf(w, "Piece length: %s\n", func() string {
if t.haveInfo() { if t.haveInfo() {
return fmt.Sprint(t.usualPieceSize()) return fmt.Sprint(t.usualPieceSize())