Improve performance, logging

This commit is contained in:
Daniel
2019-05-10 11:57:51 +02:00
parent e72ed023db
commit 16db10b84b
9 changed files with 282 additions and 129 deletions

View File

@@ -1,6 +1,7 @@
package profile
import (
"context"
"sync"
"github.com/Safing/portbase/log"
@@ -11,13 +12,13 @@ var (
activeProfileSetsLock sync.RWMutex
)
func activateProfileSet(set *Set) {
func activateProfileSet(ctx context.Context, set *Set) {
activeProfileSetsLock.Lock()
defer activeProfileSetsLock.Unlock()
set.Lock()
defer set.Unlock()
activeProfileSets[set.id] = set
log.Tracef("profile: activated profile set %s", set.id)
log.Tracer(ctx).Tracef("profile: activated profile set %s", set.id)
}
// DeactivateProfileSet marks a profile set as not active.