MCPcopy
hub / github.com/evilsocket/opensnitch / SendError

Method SendError

daemon/firewall/common/common.go:54–72  ·  view source on GitHub ↗

SendError sends an error to the channel of errors.

(err string)

Source from the content-addressed store, hash-verified

52
53// SendError sends an error to the channel of errors.
54func (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
74func (c *Common) SetRulesCheckerInterval(interval string) {
75 dur, err := time.ParseDuration(interval)

Callers 1

AddSystemRulesMethod · 0.80

Calls 1

ErrChanEmptyMethod · 0.95

Tested by

no test coverage detected