Resetting the pinger after connection error
The healthchecker use the same pinger even if the ping fails.
This is leading into stale conntrack entries, which causes pakcet
loss even if the connection is established. So in the event of
a failure a new pinger will be created.
Fixes:
@@ -111,9 +111,17 @@ func (p *pingerInfo) doPing() error {
if pinger.PacketsSent-pinger.PacketsRecv > int(p.maxPacketLossCount) {
p.Lock()
defer p.Unlock()
-
- p.connectionStatus = ConnectionError
+ // The counter will be reset to once to ensure that it is continuous packet loss
+ // before marking the connection as down.
+ if pinger.PacketsSent <= int(p.maxPacketLossCount)+1 {
p.failureMsg = fmt.Sprintf("Failed to successfully ping the remote endpoint IP %q", p.ip)
+ p.connectionStatus = ConnectionError
+
+ pinger.Stop()
+
+ return
+ }
+
pinger.PacketsSent = 0
pinger.PacketsRecv = 0
}
