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:
parent
6da805d1b1
commit
87690e4c4c
12
torrent.go
12
torrent.go
@ -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())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user