Browse Source

update stats

pull/15/head
Jason 5 years ago
parent
commit
c67cb283f1
  1. 5
      cmd/tun2socks/main_stats.go
  2. 3
      common/stats/session/session.go

5
cmd/tun2socks/main_stats.go

@ -5,6 +5,7 @@ package main
import (
"flag"
"github.com/xjasonlyu/tun2socks/common/log"
"github.com/xjasonlyu/tun2socks/common/stats/session"
)
@ -19,7 +20,9 @@ func init() {
session.StatsVersion = version
sessionStater = session.NewSimpleSessionStater()
sessionStater.Start()
if err := sessionStater.Start(); err != nil {
log.Fatalf("start session stater failed: %v", err)
}
} else {
sessionStater = nil
}

3
common/stats/session/session.go

@ -97,8 +97,7 @@ func (s *simpleSessionStater) Start() error {
})
mux.HandleFunc(StatsPath, sessionStatsHandler)
s.server = &http.Server{Addr: StatsAddr, Handler: mux}
go s.server.ListenAndServe()
return nil
return s.server.ListenAndServe()
}
func (s *simpleSessionStater) Stop() error {

Loading…
Cancel
Save