stats/udp: nop on nil DefaultStats

This commit is contained in:
Jimmy Zelinskie
2015-02-25 21:56:58 -05:00
parent 5af37be85c
commit 9b4999c0cf
2 changed files with 16 additions and 13 deletions

View File

@@ -13,21 +13,18 @@ import (
"time"
"github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/stats"
"github.com/chihaya/chihaya/tracker"
_ "github.com/chihaya/chihaya/backend/noop"
)
var testPort = "34137"
var connectAction = []byte{0, 0, 0, byte(connectActionID)}
var announceAction = []byte{0, 0, 0, byte(announceActionID)}
var scrapeAction = []byte{0, 0, 0, byte(scrapeActionID)}
var errorAction = []byte{0, 0, 0, byte(errorActionID)}
func init() {
stats.DefaultStats = stats.New(config.StatsConfig{})
}
var (
testPort = "34137"
connectAction = []byte{0, 0, 0, byte(connectActionID)}
announceAction = []byte{0, 0, 0, byte(announceActionID)}
scrapeAction = []byte{0, 0, 0, byte(scrapeActionID)}
errorAction = []byte{0, 0, 0, byte(errorActionID)}
)
func setupTracker(cfg *config.Config) (*Server, chan struct{}, error) {
tkr, err := tracker.New(cfg)