(id int, done <-chan struct{})
| 178 | } |
| 179 | |
| 180 | func (s *Statistics) eventWorker(id int, done <-chan struct{}) { |
| 181 | log.Debug("Stats worker #%d started.", id) |
| 182 | |
| 183 | for true { |
| 184 | select { |
| 185 | case <-done: |
| 186 | goto Exit |
| 187 | case job := <-s.jobs: |
| 188 | s.onConnection(job.con, job.match, job.wasMissed) |
| 189 | } |
| 190 | } |
| 191 | Exit: |
| 192 | log.Debug("stats.worker() %d exited", id) |
| 193 | } |
| 194 | |
| 195 | func (s *Statistics) onConnection(con *conman.Connection, match *rule.Rule, wasMissed bool) { |
| 196 | s.Lock() |