Merge pull request #3155 from influxdb/collectd_panic

Create UDP batcher before listening for UDP
pull/3165/head
Philip O'Toole 2015-06-26 10:34:33 -04:00
commit fb86210b89
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,9 @@
## v0.9.2 [unreleased]
### Bugfixes
- [3155](https://github.com/influxdb/influxdb/pull/3155): Instantiate UDP batcher before listening for UDP traffic, otherwise a panic may result.
## v0.9.1 [2015-06-26]
### Features

View File

@ -39,9 +39,10 @@ type Service struct {
func NewService(c Config) *Service {
return &Service{
config: c,
done: make(chan struct{}),
Logger: log.New(os.Stderr, "[udp] ", log.LstdFlags),
config: c,
done: make(chan struct{}),
batcher: tsdb.NewPointBatcher(c.BatchSize, time.Duration(c.BatchTimeout)),
Logger: log.New(os.Stderr, "[udp] ", log.LstdFlags),
}
}
@ -67,8 +68,6 @@ func (s *Service) Open() (err error) {
s.Logger.Printf("Started listening on %s", s.config.BindAddress)
s.batcher = tsdb.NewPointBatcher(s.config.BatchSize, time.Duration(s.config.BatchTimeout))
s.wg.Add(2)
go s.serve()
go s.writePoints()