Add more information I've needed to the status page
This commit is contained in:
parent
0d27ae7fd1
commit
8910eb660d
|
@ -120,6 +120,9 @@ type Client struct {
|
|||
func (cl *Client) WriteStatus(w io.Writer) {
|
||||
cl.mu.Lock()
|
||||
defer cl.mu.Unlock()
|
||||
fmt.Fprintf(w, "Half open: %d\n", cl.halfOpen)
|
||||
fmt.Fprintf(w, "DHT nodes: %d\n", cl.DHT.NumNodes())
|
||||
fmt.Fprintln(w)
|
||||
for _, t := range cl.torrents {
|
||||
fmt.Fprintf(w, "%s: %f%%\n", t.Name(), func() float32 {
|
||||
if !t.haveInfo() {
|
||||
|
|
|
@ -69,7 +69,7 @@ func (cn *connection) piecesPeerHasCount() (count int) {
|
|||
}
|
||||
|
||||
func (cn *connection) WriteStatus(w io.Writer) {
|
||||
fmt.Fprintf(w, "%q: %s-%s: %s completed: ", cn.PeerId, cn.Socket.LocalAddr(), cn.Socket.RemoteAddr(), cn.completedString())
|
||||
fmt.Fprintf(w, "%q: %s-%s: %s completed, reqs: %d-%d, flags: ", cn.PeerId, cn.Socket.LocalAddr(), cn.Socket.RemoteAddr(), cn.completedString(), len(cn.Requests), len(cn.PeerRequests))
|
||||
c := func(b byte) {
|
||||
fmt.Fprintf(w, "%c", b)
|
||||
}
|
||||
|
|
|
@ -679,6 +679,12 @@ func (s *Server) Bootstrap() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Server) NumNodes() int {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return len(s.nodes)
|
||||
}
|
||||
|
||||
func (s *Server) Nodes() (nis []NodeInfo) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
|
|
@ -206,6 +206,7 @@ func (t *torrent) WriteStatus(w io.Writer) {
|
|||
fmt.Fprintf(w, "\t%v\n", e.Value)
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(w, "Pending peers: %d\n", len(t.Peers))
|
||||
for _, c := range t.Conns {
|
||||
c.WriteStatus(w)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue