From 6d6b03cac306650189276c09b3b629658e0bfdbd Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 24 Apr 2020 11:31:26 +0200 Subject: [PATCH] Remove deprecated code --- status/module.go | 2 -- status/set.go | 42 ------------------------------------------ status/set_test.go | 2 -- status/status.go | 8 -------- status/updates.go | 18 ------------------ 5 files changed, 72 deletions(-) delete mode 100644 status/updates.go diff --git a/status/module.go b/status/module.go index da3486e9..a3b64085 100644 --- a/status/module.go +++ b/status/module.go @@ -37,8 +37,6 @@ func start() error { // load status into atomic getters atomicUpdateSelectedSecurityLevel(status.SelectedSecurityLevel) - atomicUpdatePortmasterStatus(status.PortmasterStatus) - atomicUpdateGate17Status(status.Gate17Status) // update status status.updateThreatMitigationLevel() diff --git a/status/set.go b/status/set.go index 036995d4..a7815bef 100644 --- a/status/set.go +++ b/status/set.go @@ -45,40 +45,6 @@ func setSelectedSecurityLevel(level uint8) { } } -// SetPortmasterStatus sets the current Portmaster status. -func SetPortmasterStatus(pmStatus uint8, msg string) { - switch pmStatus { - case StatusOff, StatusError, StatusWarning, StatusOk: - status.Lock() - defer status.Unlock() - - status.PortmasterStatus = pmStatus - status.PortmasterStatusMsg = msg - atomicUpdatePortmasterStatus(pmStatus) - - go status.Save() - default: - log.Errorf("status: tried to set portmaster to invalid status: %d", pmStatus) - } -} - -// SetGate17Status sets the current Gate17 status. -func SetGate17Status(g17Status uint8, msg string) { - switch g17Status { - case StatusOff, StatusError, StatusWarning, StatusOk: - status.Lock() - defer status.Unlock() - - status.Gate17Status = g17Status - status.Gate17StatusMsg = msg - atomicUpdateGate17Status(g17Status) - - go status.Save() - default: - log.Errorf("status: tried to set gate17 to invalid status: %d", g17Status) - } -} - // update functions for atomic stuff func atomicUpdateActiveSecurityLevel(level uint8) { atomic.StoreUint32(activeSecurityLevel, uint32(level)) @@ -87,11 +53,3 @@ func atomicUpdateActiveSecurityLevel(level uint8) { func atomicUpdateSelectedSecurityLevel(level uint8) { atomic.StoreUint32(selectedSecurityLevel, uint32(level)) } - -func atomicUpdatePortmasterStatus(status uint8) { - atomic.StoreUint32(portmasterStatus, uint32(status)) -} - -func atomicUpdateGate17Status(status uint8) { - atomic.StoreUint32(gate17Status, uint32(status)) -} diff --git a/status/set_test.go b/status/set_test.go index 3502c152..7bb70f41 100644 --- a/status/set_test.go +++ b/status/set_test.go @@ -7,7 +7,5 @@ func TestSet(t *testing.T) { // only test for panics // TODO: write real tests setSelectedSecurityLevel(0) - SetPortmasterStatus(0, "") - SetGate17Status(0, "") } diff --git a/status/status.go b/status/status.go index f25981e5..544b764b 100644 --- a/status/status.go +++ b/status/status.go @@ -28,16 +28,8 @@ type SystemStatus struct { ActiveSecurityLevel uint8 SelectedSecurityLevel uint8 - PortmasterStatus uint8 - PortmasterStatusMsg string - - Gate17Status uint8 - Gate17StatusMsg string - ThreatMitigationLevel uint8 Threats map[string]*Threat - - UpdateStatus string } // Save saves the SystemStatus to the database diff --git a/status/updates.go b/status/updates.go deleted file mode 100644 index 2b9ef79f..00000000 --- a/status/updates.go +++ /dev/null @@ -1,18 +0,0 @@ -package status - -// Update status options -const ( - UpdateStatusCurrentStable = "stable" - UpdateStatusCurrentBeta = "beta" - UpdateStatusAvailable = "available" // restart or reboot required - UpdateStatusFailed = "failed" // check logs -) - -// SetUpdateStatus updates the system status with a new update status. -func SetUpdateStatus(newStatus string) { - status.Lock() - status.UpdateStatus = newStatus - status.Unlock() - - go status.Save() -}