allow ConnStats being marsheled to json
This commit is contained in:
parent
d2400968fc
commit
25d76e0449
|
@ -5,6 +5,7 @@ import (
|
|||
"io"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
"encoding/json"
|
||||
|
||||
pp "github.com/anacrolix/torrent/peer_protocol"
|
||||
)
|
||||
|
@ -65,6 +66,10 @@ func (me *Count) String() string {
|
|||
return fmt.Sprintf("%v", me.Int64())
|
||||
}
|
||||
|
||||
func (me *Count) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(me.n)
|
||||
}
|
||||
|
||||
func (cs *ConnStats) wroteMsg(msg *pp.Message) {
|
||||
// TODO: Track messages and not just chunks.
|
||||
switch msg.Type {
|
||||
|
|
Loading…
Reference in New Issue