fix(go.d/portcheck): stop checking UDP ports on ICMP listen error (#18721)
Ilya Mashchenko committed
Oct 8, 2024 at 16:30 UTC
039dc7e4e08f7ae569732835e16e7034e8dda1ec
1 file changed
+7
-4
src/go/plugin/go.d/modules/portcheck/collect.go
+7
-4
@@ -20,10 +20,13 @@ func (pc *PortCheck) collect() (map[string]int64, error) {
20
port := port
21
go func() { defer wg.Done(); pc.checkTCPPort(port) }()
22
}
23
- for _, port := range pc.udpPorts {
24
- wg.Add(1)
25
- port := port
26
- go func() { defer wg.Done(); pc.checkUDPPort(port) }()
23
+
24
+ if pc.doUdpPorts {
25
+ for _, port := range pc.udpPorts {
26
+ wg.Add(1)
27
+ port := port
28
+ go func() { defer wg.Done(); pc.checkUDPPort(port) }()
29
+ }
30
}
31
32
wg.Wait()