fix(inputs.statsd): On close, verify listener is not nil (#12778)
This commit is contained in:
parent
e2a510f157
commit
dfe8b43e20
|
|
@ -944,9 +944,14 @@ func (s *Statsd) Stop() {
|
||||||
s.Log.Infof("Stopping the statsd service")
|
s.Log.Infof("Stopping the statsd service")
|
||||||
close(s.done)
|
close(s.done)
|
||||||
if s.isUDP() {
|
if s.isUDP() {
|
||||||
s.UDPlistener.Close() //nolint:revive // Ignore the returned error as we cannot do anything about it anyway
|
if s.UDPlistener != nil {
|
||||||
|
s.UDPlistener.Close() //nolint:revive // Ignore the returned error as we cannot do anything about it anyway
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
s.TCPlistener.Close() //nolint:revive // Ignore the returned error as we cannot do anything about it anyway
|
if s.TCPlistener != nil {
|
||||||
|
s.TCPlistener.Close() //nolint:revive // Ignore the returned error as we cannot do anything about it anyway
|
||||||
|
}
|
||||||
|
|
||||||
// Close all open TCP connections
|
// Close all open TCP connections
|
||||||
// - get all conns from the s.conns map and put into slice
|
// - get all conns from the s.conns map and put into slice
|
||||||
// - this is so the forget() function doesnt conflict with looping
|
// - this is so the forget() function doesnt conflict with looping
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue