mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Remove deprecated MarkUsed functions
This commit is contained in:
parent
0bd3467286
commit
2cbaf126e9
3 changed files with 1 additions and 33 deletions
|
@ -105,11 +105,8 @@ func (p *Process) UpdateProfileMetadata() {
|
||||||
// Update metadata of profile.
|
// Update metadata of profile.
|
||||||
metadataUpdated := localProfile.UpdateMetadata(p.Path)
|
metadataUpdated := localProfile.UpdateMetadata(p.Path)
|
||||||
|
|
||||||
// Mark profile as used.
|
|
||||||
profileChanged := localProfile.MarkUsed()
|
|
||||||
|
|
||||||
// Save the profile if we changed something.
|
// Save the profile if we changed something.
|
||||||
if metadataUpdated || profileChanged {
|
if metadataUpdated {
|
||||||
err := localProfile.Save()
|
err := localProfile.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("process: failed to save profile %s: %s", localProfile.ScopedID(), err)
|
log.Warningf("process: failed to save profile %s: %s", localProfile.ScopedID(), err)
|
||||||
|
|
|
@ -276,11 +276,6 @@ func (lp *LayeredProfile) updateCaches() {
|
||||||
atomic.StoreUint32(lp.securityLevel, uint32(newLevel))
|
atomic.StoreUint32(lp.securityLevel, uint32(newLevel))
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkUsed marks the localProfile as used.
|
|
||||||
func (lp *LayeredProfile) MarkUsed() {
|
|
||||||
lp.localProfile.MarkUsed()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SecurityLevel returns the highest security level of all layered profiles. This function is atomic and does not require any locking.
|
// SecurityLevel returns the highest security level of all layered profiles. This function is atomic and does not require any locking.
|
||||||
func (lp *LayeredProfile) SecurityLevel() uint8 {
|
func (lp *LayeredProfile) SecurityLevel() uint8 {
|
||||||
return uint8(atomic.LoadUint32(lp.securityLevel))
|
return uint8(atomic.LoadUint32(lp.securityLevel))
|
||||||
|
|
|
@ -281,30 +281,6 @@ func (profile *Profile) LastActive() int64 {
|
||||||
return atomic.LoadInt64(profile.lastActive)
|
return atomic.LoadInt64(profile.lastActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkUsed updates ApproxLastUsed when it's been a while and saves the profile if it was changed.
|
|
||||||
func (profile *Profile) MarkUsed() (changed bool) {
|
|
||||||
/*
|
|
||||||
TODO:
|
|
||||||
This might be one of the things causing problems with disappearing settings.
|
|
||||||
Possibly this is called with an outdated profile and then kills settings
|
|
||||||
already in the database.
|
|
||||||
Generally, it probably causes more harm than good if we periodically touch
|
|
||||||
the most important database entries just to update a timestamp.
|
|
||||||
We should save this data elsewhere and make configuration data as stable as
|
|
||||||
possible.
|
|
||||||
|
|
||||||
profile.Lock()
|
|
||||||
defer profile.Unlock()
|
|
||||||
|
|
||||||
if time.Now().Add(-lastUsedUpdateThreshold).Unix() > profile.ApproxLastUsed {
|
|
||||||
profile.ApproxLastUsed = time.Now().Unix()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns a string representation of the Profile.
|
// String returns a string representation of the Profile.
|
||||||
func (profile *Profile) String() string {
|
func (profile *Profile) String() string {
|
||||||
return fmt.Sprintf("<%s %s/%s>", profile.Name, profile.Source, profile.ID)
|
return fmt.Sprintf("<%s %s/%s>", profile.Name, profile.Source, profile.ID)
|
||||||
|
|
Loading…
Add table
Reference in a new issue