From e464ee136cc2e16f46a64905f582abdeb00dc177 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 20 May 2020 15:14:48 +0200 Subject: [PATCH] Fix superfluous decision re-evaluations --- network/connection.go | 3 ++- profile/profile-layered.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/network/connection.go b/network/connection.go index 2fa5f9df..4c5acbcf 100644 --- a/network/connection.go +++ b/network/connection.go @@ -178,7 +178,8 @@ func NewConnectionFromFirstPacket(pkt packet.Packet) *Connection { // remote endpoint Entity: entity, // meta - Started: time.Now().Unix(), + Started: time.Now().Unix(), + profileRevisionCounter: proc.Profile().RevisionCnt(), } } diff --git a/profile/profile-layered.go b/profile/profile-layered.go index 45311662..ab0335a2 100644 --- a/profile/profile-layered.go +++ b/profile/profile-layered.go @@ -126,6 +126,18 @@ func (lp *LayeredProfile) getValidityFlag() *abool.AtomicBool { return lp.validityFlag } +// RevisionCnt returns the current profile revision counter. +func (lp *LayeredProfile) RevisionCnt() (revisionCounter uint64) { + if lp == nil { + return 0 + } + + lp.lock.Lock() + defer lp.lock.Unlock() + + return lp.revisionCounter +} + // Update checks for updated profiles and replaces any outdated profiles. func (lp *LayeredProfile) Update() (revisionCounter uint64) { lp.lock.Lock()