Unconnected raw ICMP sockets receive every ICMP packet arriving at the host, so any ICMP traffic refreshed the read deadline of every flow and stale flows (with their raw sockets and goroutines) were only reclaimed by LRU eviction while processing all host ICMP traffic in the meantime. Expire flows based on their own activity only, and on Linux attach a classic BPF ident filter to each raw socket so other flows' packets are dropped in the kernel instead of waking every flow.
8 lines
125 B
Go
8 lines
125 B
Go
//go:build !linux
|
|
|
|
package ping
|
|
|
|
type identFilterState struct{}
|
|
|
|
func (c *Conn) updateIdentFilter(wireIdentifier uint16) {
|
|
}
|