Use CallLimiter2
This commit is contained in:
@@ -19,7 +19,7 @@ var (
|
||||
// pidsByUserLock is also used for locking the socketInfo.PID on all socket.*Info structs.
|
||||
pidsByUser = make(map[int][]int)
|
||||
pidsByUserLock sync.RWMutex
|
||||
fetchPidsByUser = utils.NewCallLimiter(10 * time.Millisecond)
|
||||
fetchPidsByUser = utils.NewCallLimiter2(10 * time.Millisecond)
|
||||
)
|
||||
|
||||
// getPidsByUser returns the cached PIDs for the given UID.
|
||||
|
||||
@@ -25,7 +25,7 @@ type tcpTable struct {
|
||||
// lastUpdateAt stores the time when the tables where last updated as unix nanoseconds.
|
||||
lastUpdateAt atomic.Int64
|
||||
|
||||
fetchLimiter *utils.CallLimiter
|
||||
fetchLimiter *utils.CallLimiter2
|
||||
fetchTable func() (connections []*socket.ConnectionInfo, listeners []*socket.BindInfo, err error)
|
||||
|
||||
dualStack *tcpTable
|
||||
@@ -34,13 +34,13 @@ type tcpTable struct {
|
||||
var (
|
||||
tcp6Table = &tcpTable{
|
||||
version: 6,
|
||||
fetchLimiter: utils.NewCallLimiter(minDurationBetweenTableUpdates),
|
||||
fetchLimiter: utils.NewCallLimiter2(minDurationBetweenTableUpdates),
|
||||
fetchTable: getTCP6Table,
|
||||
}
|
||||
|
||||
tcp4Table = &tcpTable{
|
||||
version: 4,
|
||||
fetchLimiter: utils.NewCallLimiter(minDurationBetweenTableUpdates),
|
||||
fetchLimiter: utils.NewCallLimiter2(minDurationBetweenTableUpdates),
|
||||
fetchTable: getTCP4Table,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ type udpTable struct {
|
||||
// lastUpdateAt stores the time when the tables where last updated as unix nanoseconds.
|
||||
lastUpdateAt atomic.Int64
|
||||
|
||||
fetchLimiter *utils.CallLimiter
|
||||
fetchLimiter *utils.CallLimiter2
|
||||
fetchTable func() (binds []*socket.BindInfo, err error)
|
||||
|
||||
states map[string]map[string]*udpState
|
||||
@@ -52,14 +52,14 @@ const (
|
||||
var (
|
||||
udp6Table = &udpTable{
|
||||
version: 6,
|
||||
fetchLimiter: utils.NewCallLimiter(minDurationBetweenTableUpdates),
|
||||
fetchLimiter: utils.NewCallLimiter2(minDurationBetweenTableUpdates),
|
||||
fetchTable: getUDP6Table,
|
||||
states: make(map[string]map[string]*udpState),
|
||||
}
|
||||
|
||||
udp4Table = &udpTable{
|
||||
version: 4,
|
||||
fetchLimiter: utils.NewCallLimiter(minDurationBetweenTableUpdates),
|
||||
fetchLimiter: utils.NewCallLimiter2(minDurationBetweenTableUpdates),
|
||||
fetchTable: getUDP4Table,
|
||||
states: make(map[string]map[string]*udpState),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user