Fix getting updated tables immediately

This commit is contained in:
Daniel
2023-03-30 16:03:06 +02:00
parent 6070366399
commit d9f4a9e70b
2 changed files with 5 additions and 5 deletions

View File

@@ -25,12 +25,12 @@ type Info struct {
func GetInfo() *Info {
info := &Info{}
info.TCP4Connections, info.TCP4Listeners, _ = tcp4Table.updateTables(0)
info.UDP4Binds, _ = udp4Table.updateTables(0)
info.TCP4Connections, info.TCP4Listeners, _ = tcp4Table.updateTables(tcp4Table.updateIter.Load())
info.UDP4Binds, _ = udp4Table.updateTables(udp4Table.updateIter.Load())
if netenv.IPv6Enabled() {
info.TCP6Connections, info.TCP6Listeners, _ = tcp6Table.updateTables(tcp6Table.updateIter.Load())
info.UDP6Binds, _ = udp6Table.updateTables(0)
info.UDP6Binds, _ = udp6Table.updateTables(udp6Table.updateIter.Load())
}
info.UpdateMeta()

View File

@@ -168,11 +168,11 @@ func (table *udpTable) updateTables(previousUpdateIter uint64) (
func CleanUDPStates(_ context.Context) {
now := time.Now().UTC()
udp4Table.updateTables(0)
udp4Table.updateTables(udp4Table.updateIter.Load())
udp4Table.cleanStates(now)
if netenv.IPv6Enabled() {
udp6Table.updateTables(0)
udp6Table.updateTables(udp6Table.updateIter.Load())
udp6Table.cleanStates(now)
}
}