Work on portmaster restructuring

This commit is contained in:
Daniel
2018-11-27 16:39:06 +01:00
parent 99851166a0
commit 5bdb021c88
38 changed files with 605 additions and 332 deletions

View File

@@ -5,41 +5,41 @@ import "sync/atomic"
// SetCurrentSecurityLevel sets the current security level.
func SetCurrentSecurityLevel(level uint8) {
sysStatusLock.Lock()
defer sysStatusLock.Unlock()
sysStatus.CurrentSecurityLevel = level
atomicUpdateCurrentSecurityLevel(level)
defer sysStatusLock.Unlock()
sysStatus.CurrentSecurityLevel = level
atomicUpdateCurrentSecurityLevel(level)
}
// SetSelectedSecurityLevel sets the selected security level.
func SetSelectedSecurityLevel(level uint8) {
sysStatusLock.Lock()
defer sysStatusLock.Unlock()
sysStatus.SelectedSecurityLevel = level
atomicUpdateSelectedSecurityLevel(level)
defer sysStatusLock.Unlock()
sysStatus.SelectedSecurityLevel = level
atomicUpdateSelectedSecurityLevel(level)
}
// SetThreatLevel sets the current threat level.
func SetThreatLevel(level uint8) {
sysStatusLock.Lock()
defer sysStatusLock.Unlock()
sysStatus.ThreatLevel = level
atomicUpdateThreatLevel(level)
defer sysStatusLock.Unlock()
sysStatus.ThreatLevel = level
atomicUpdateThreatLevel(level)
}
// SetPortmasterStatus sets the current Portmaster status.
func SetPortmasterStatus(status uint8) {
sysStatusLock.Lock()
defer sysStatusLock.Unlock()
sysStatus.PortmasterStatus = status
atomicUpdatePortmasterStatus(status)
defer sysStatusLock.Unlock()
sysStatus.PortmasterStatus = status
atomicUpdatePortmasterStatus(status)
}
// SetGate17Status sets the current Gate17 status.
func SetGate17Status(status uint8) {
sysStatusLock.Lock()
defer sysStatusLock.Unlock()
sysStatus.Gate17Status = status
atomicUpdateGate17Status(status)
defer sysStatusLock.Unlock()
sysStatus.Gate17Status = status
atomicUpdateGate17Status(status)
}
// update functions for atomic stuff