global.go | 7 ++++++- peerconn.go | 2 +- diff --git a/global.go b/global.go index 6542ac393daaf324d9b2427db851b559d707aea1..ff237c8ee1edda4f9d464d08d9db1bb49c7fa670 100644 --- a/global.go +++ b/global.go @@ -24,10 +24,15 @@ func defaultPeerExtensionBytes() PeerExtensionBits { return pp.NewPeerExtensionBytes(pp.ExtensionBitDHT, pp.ExtensionBitExtended, pp.ExtensionBitFast) } +func init() { + torrent.Set("peers supporting extension", &peersSupportingExtension) +} + // I could move a lot of these counters to their own file, but I suspect they // may be attached to a Client someday. var ( - torrent = expvar.NewMap("torrent") + torrent = expvar.NewMap("torrent") + peersSupportingExtension expvar.Map pieceHashedCorrect = expvar.NewInt("pieceHashedCorrect") pieceHashedNotCorrect = expvar.NewInt("pieceHashedNotCorrect") diff --git a/peerconn.go b/peerconn.go index 535ba737fca0765413868c03bed9d03b5b8cbff0..41e8662d295f31dcd93e81720ccbf5cbb31b157b 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1308,7 +1308,7 @@ c.PeerListenPort = d.Port c.PeerPrefersEncryption = d.Encryption for name, id := range d.M { if _, ok := c.PeerExtensionIDs[name]; !ok { - torrent.Add(fmt.Sprintf("peers supporting extension %q", name), 1) + peersSupportingExtension.Add(string(name), 1) } c.PeerExtensionIDs[name] = id }