Some changes to status output

This commit is contained in:
Matt Joiner 2018-02-01 18:45:58 +11:00
parent 1e9f342a15
commit 2166bf1ec0
2 changed files with 3 additions and 3 deletions

View File

@ -205,10 +205,10 @@ func (cn *connection) String() string {
func (cn *connection) WriteStatus(w io.Writer, t *Torrent) { func (cn *connection) WriteStatus(w io.Writer, t *Torrent) {
// \t isn't preserved in <pre> blocks? // \t isn't preserved in <pre> blocks?
fmt.Fprintf(w, "%-40s: %s-%s\n", cn.PeerID, cn.localAddr(), cn.remoteAddr()) fmt.Fprintf(w, "%-40s: %s-%s\n", cn.PeerID, cn.localAddr(), cn.remoteAddr())
fmt.Fprintf(w, " last msg: %s, connected: %s, last useful chunk: %s\n", fmt.Fprintf(w, " last msg: %s, connected: %s, last helpful: %s\n",
eventAgeString(cn.lastMessageReceived), eventAgeString(cn.lastMessageReceived),
eventAgeString(cn.completedHandshake), eventAgeString(cn.completedHandshake),
eventAgeString(cn.lastUsefulChunkReceived)) eventAgeString(cn.lastHelpful()))
fmt.Fprintf(w, fmt.Fprintf(w,
" %s completed, %d pieces touched, good chunks: %d/%d-%d reqq: %d-%d, flags: %s\n", " %s completed, %d pieces touched, good chunks: %d/%d-%d reqq: %d-%d, flags: %s\n",
cn.completedString(), cn.completedString(),

View File

@ -557,7 +557,7 @@ func (t *Torrent) writeStatus(w io.Writer) {
} }
}()) }())
if t.info != nil { if t.info != nil {
fmt.Fprintf(w, "Num Pieces: %d\n", t.numPieces()) fmt.Fprintf(w, "Num Pieces: %d (%d completed)\n", t.numPieces(), t.numPiecesCompleted())
fmt.Fprint(w, "Piece States:") fmt.Fprint(w, "Piece States:")
for _, psr := range t.pieceStateRuns() { for _, psr := range t.pieceStateRuns() {
w.Write([]byte(" ")) w.Write([]byte(" "))