SendError sends an error to the channel of errors.
(err string)
| 52 | |
| 53 | // SendError sends an error to the channel of errors. |
| 54 | func (c *Common) SendError(err string) { |
| 55 | log.Warning("%s", err) |
| 56 | |
| 57 | if len(c.ErrChan) >= cap(c.ErrChan) { |
| 58 | log.Debug("fw errors channel full, emptying errChan") |
| 59 | for e := range c.ErrChan { |
| 60 | log.Warning("%s", e) |
| 61 | if c.ErrChanEmpty() { |
| 62 | break |
| 63 | } |
| 64 | } |
| 65 | return |
| 66 | } |
| 67 | select { |
| 68 | case c.ErrChan <- err: |
| 69 | case <-time.After(100 * time.Millisecond): |
| 70 | log.Warning("SendError() channel locked? REVIEW") |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | func (c *Common) SetRulesCheckerInterval(interval string) { |
| 75 | dur, err := time.ParseDuration(interval) |
no test coverage detected