Add retry for linux process search

This commit is contained in:
世界 2022-07-24 21:43:05 +08:00
parent 7d8a7c5c7d
commit 29c329dc52
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -38,6 +38,16 @@ const (
) )
func resolveSocketByNetlink(network string, ip netip.Addr, srcPort int) (inode int32, uid int32, err error) { func resolveSocketByNetlink(network string, ip netip.Addr, srcPort int) (inode int32, uid int32, err error) {
for attempts := 0; attempts < 3; attempts++ {
inode, uid, err = resolveSocketByNetlink0(network, ip, srcPort)
if err == nil {
return
}
}
return
}
func resolveSocketByNetlink0(network string, ip netip.Addr, srcPort int) (inode int32, uid int32, err error) {
var family byte var family byte
var protocol byte var protocol byte