From 783cf8a2b983186b371cec346ad9151eebcc5ed1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 3 Apr 2016 02:13:33 +0200 Subject: remove bloat diff --git a/src/rhctl/switch_control.go b/src/rhctl/switch_control.go index 09c68a3..a73d465 100644 --- a/src/rhctl/switch_control.go +++ b/src/rhctl/switch_control.go @@ -57,24 +57,6 @@ type State struct { Server map[string]ServerState } -func (ctrl *SwitchControl) updateOverallState(update interface{}) { - switch update.(type) { - case SwitchState: - // s := update.(SwitchState) - rhdl.Printf("SwitchCTRL: got switch update updateting overall-state") - // TODO: update ctrl.state - case ServerState: - s := update.(ServerState) - rhdl.Printf("SwitchCTRL: got server update from '%s' updateting overall-state", s.Name) - // TODO: update ctrl.state - default: - rhl.Printf("SwitchCTRL: got unknown state-update of type %T", update) - return - } - rhdl.Printf("SwitchCTRL: overall-state is now: %+v", ctrl.state) - return -} - type CommandType uint8 const ( @@ -142,6 +124,8 @@ func (ctrl *SwitchControl) reconcile() { // TODO: send out commands to switch, server to get missing infos + // TODO: change active server it fails + // TODO: change switch output mappings if servers change channels or fail } @@ -165,13 +149,13 @@ func (ctrl *SwitchControl) Run() { case state := <-ctrl.sw.StateChanges: rhdl.Printf("got switch state update: %+v", state) ctrl.Updates.Pub(state, "switch:state") - ctrl.updateOverallState(state) + ctrl.state.Switch = state ctrl.reconcile() ctrl.Updates.Pub(ctrl.state, "state") case state := <-serverStateChanges: rhdl.Printf("got server state update: %+v", state) ctrl.Updates.Pub(state, "server:state") - ctrl.updateOverallState(state) + ctrl.state.Server[state.Name] = state ctrl.reconcile() ctrl.Updates.Pub(ctrl.state, "state") case cmd := <-ctrl.Commands: -- cgit v0.10.2