projects
/
btrtrc.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d240096
)
allow ConnStats being marsheled to json
author
boypt <1033514+boypt@users.noreply.github.com>
Thu, 23 May 2019 05:58:17 +0000 (13:58 +0800)
committer
Matt Joiner <anacrolix@gmail.com>
Wed, 29 May 2019 05:05:31 +0000 (15:05 +1000)
conn_stats.go
patch
|
blob
|
history
diff --git
a/conn_stats.go
b/conn_stats.go
index a691fb342f24bbe30fac479840097c8901e5dd5c..06ec23f2cb6eed31c149f65629180bb673bad82e 100644
(file)
--- a/
conn_stats.go
+++ b/
conn_stats.go
@@
-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 {