diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-09-24 12:05:35 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-09-24 12:05:35 (GMT) |
commit | 301ad925c1e202f4264ae5d45e21e4f0a837458c (patch) | |
tree | 13f1b7cba52e65e59d0853c724e450ec8c07a573 | |
parent | e9ebe0a8ed3416938e4a703750628bc57951dc74 (diff) |
changed vs. updated
-rw-r--r-- | src/rhctl/audio_switch.go | 22 | ||||
-rw-r--r-- | src/rhctl/playout_server.go | 8 | ||||
-rw-r--r-- | src/rhctl/switch_control.go | 12 | ||||
-rw-r--r-- | src/rhctl/telnet.go | 12 |
4 files changed, 27 insertions, 27 deletions
diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go index 3623138..a5c1a5c 100644 --- a/src/rhctl/audio_switch.go +++ b/src/rhctl/audio_switch.go @@ -85,14 +85,14 @@ type SwitchState struct { Inputs [SwitchInputNumMax]bool Silence bool } - AudioInputsChanged time.Time - AudioSilenceChanged time.Time + AudioInputsUpdated time.Time + AudioSilenceUpdated time.Time GPI [SwitchGPINumMax]bool - GPIChanged time.Time + GPIUpdated time.Time Relay [SwitchRelayNumMax]bool - RelayChanged time.Time + RelayUpdated time.Time OC [SwitchOCNumMax]bool - OCChanged time.Time + OCUpdated time.Time } type AudioSwitch struct { @@ -133,7 +133,7 @@ func (sw *AudioSwitch) updateStateAudio(data string) { rhl.Printf("Audioswitch: invalid audio status update (state must be either '1' or '0' but is '%s')", ins[i]) } } - sw.state.AudioInputsChanged = time.Now() + sw.state.AudioInputsUpdated = time.Now() sw.StateChanges <- sw.state } @@ -159,7 +159,7 @@ func (sw *AudioSwitch) updateStateGPI(data string) { rhl.Printf("Audioswitch: invalid gpi status update (state must be either '1' or '0' but is '%s')", data[7:8]) return } - sw.state.GPIChanged = time.Now() + sw.state.GPIUpdated = time.Now() sw.StateChanges <- sw.state return } @@ -185,7 +185,7 @@ func (sw *AudioSwitch) updateStateGPI(data string) { rhl.Printf("Audioswitch: invalid gpi status update (state must be either '1' or '0' but is '%s')", ins[i]) } } - sw.state.GPIChanged = time.Now() + sw.state.GPIUpdated = time.Now() sw.StateChanges <- sw.state } @@ -210,7 +210,7 @@ func (sw *AudioSwitch) updateStateRelay(data string) { rhl.Printf("Audioswitch: invalid relay status update (state must be either '1' or '0' but is '%s')", outs[i]) } } - sw.state.RelayChanged = time.Now() + sw.state.RelayUpdated = time.Now() sw.StateChanges <- sw.state } @@ -235,7 +235,7 @@ func (sw *AudioSwitch) updateStateOC(data string) { rhl.Printf("Audioswitch: invalid oc status update (state must be either '1' or '0' but is '%s')", outs[i]) } } - sw.state.OCChanged = time.Now() + sw.state.OCUpdated = time.Now() sw.StateChanges <- sw.state } @@ -260,7 +260,7 @@ func (sw *AudioSwitch) updateStateSilence(data string) { rhl.Printf("Audioswitch: invalid silence status update (state must be either '1' or '0' but is '%s')", outs[i]) } } - sw.state.AudioSilenceChanged = time.Now() + sw.state.AudioSilenceUpdated = time.Now() sw.StateChanges <- sw.state } diff --git a/src/rhctl/playout_server.go b/src/rhctl/playout_server.go index 325a3f6..2aca202 100644 --- a/src/rhctl/playout_server.go +++ b/src/rhctl/playout_server.go @@ -50,7 +50,7 @@ type ServerState struct { Name string Health ServerHealth Channel string - Changed time.Time + Updated time.Time } type PlayoutServer struct { @@ -76,7 +76,7 @@ func (srv *PlayoutServer) handleHeartbeat() { old := srv.state.Health srv.state.Health = ServerAlive - srv.state.Changed = time.Now() + srv.state.Updated = time.Now() if old != srv.state.Health { srv.StateChanges <- srv.state rhl.Printf("Server(%s): is back from the dead!", srv.name) @@ -100,7 +100,7 @@ func (srv *PlayoutServer) handleMessage(data string) { return } srv.state.Channel = data[8:] - srv.state.Changed = time.Now() + srv.state.Updated = time.Now() srv.StateChanges <- srv.state return } @@ -119,7 +119,7 @@ func (srv *PlayoutServer) handleHBTimeout() { rhl.Printf("Server(%s): heartbeat timed-out", srv.name) srv.hbcnt = 0 srv.state.Health = ServerDead - srv.state.Changed = time.Now() + srv.state.Updated = time.Now() srv.StateChanges <- srv.state } diff --git a/src/rhctl/switch_control.go b/src/rhctl/switch_control.go index cd66161..1cfd4f8 100644 --- a/src/rhctl/switch_control.go +++ b/src/rhctl/switch_control.go @@ -148,30 +148,30 @@ func handleServer(sin <-chan ServerState, sout chan<- ServerState, cin <-chan Co } func (ctrl *SwitchControl) checkMissingOrStaleStates(maxAge time.Duration) (isStale bool) { - if time.Since(ctrl.state.Switch.AudioInputsChanged) > maxAge { + if time.Since(ctrl.state.Switch.AudioInputsUpdated) > maxAge { ctrl.sw.Commands <- &SwitchCommand{SwitchCmdStateAudio, nil, nil} isStale = true } - if time.Since(ctrl.state.Switch.AudioSilenceChanged) > maxAge { + if time.Since(ctrl.state.Switch.AudioSilenceUpdated) > maxAge { ctrl.sw.Commands <- &SwitchCommand{SwitchCmdStateSilence, nil, nil} isStale = true } - if time.Since(ctrl.state.Switch.GPIChanged) > maxAge { + if time.Since(ctrl.state.Switch.GPIUpdated) > maxAge { ctrl.sw.Commands <- &SwitchCommand{SwitchCmdStateGPIAll, nil, nil} isStale = true } - if time.Since(ctrl.state.Switch.RelayChanged) > maxAge { + if time.Since(ctrl.state.Switch.RelayUpdated) > maxAge { ctrl.sw.Commands <- &SwitchCommand{SwitchCmdStateRelay, nil, nil} isStale = true } - if time.Since(ctrl.state.Switch.OCChanged) > maxAge { + if time.Since(ctrl.state.Switch.OCUpdated) > maxAge { ctrl.sw.Commands <- &SwitchCommand{SwitchCmdStateOC, nil, nil} isStale = true } for _, server := range ctrl.servers { s, exists := ctrl.state.Server[server.name] - if !exists || time.Since(s.Changed) > maxAge { + if !exists || time.Since(s.Updated) > maxAge { server.UpdateRequest <- true isStale = true } diff --git a/src/rhctl/telnet.go b/src/rhctl/telnet.go index 77362bc..9a84bd8 100644 --- a/src/rhctl/telnet.go +++ b/src/rhctl/telnet.go @@ -63,19 +63,19 @@ func telnetCmdState(c *telgo.Client, args []string, ctrl *SwitchControl) bool { } c.Sayln("Switch:") - c.Sayln(" audio: (last changed: %v ago)", time.Since(s.Switch.AudioInputsChanged)) + c.Sayln(" audio: (last updated: %v ago)", time.Since(s.Switch.AudioInputsUpdated)) for num, out := range s.Switch.Audio { c.Say(" out %d: ", num+1) if out.Silence { - c.Sayln("%s (silent, since > %v)", genStateString(out.Inputs[:]), time.Since(s.Switch.AudioSilenceChanged)) + c.Sayln("%s (silent, since > %v)", genStateString(out.Inputs[:]), time.Since(s.Switch.AudioSilenceUpdated)) } else { c.Sayln("%s", genStateString(out.Inputs[:])) } } - c.Sayln(" gpi: %s (last changed: %v ago)", genStateString(s.Switch.GPI[:]), time.Since(s.Switch.GPIChanged)) - c.Sayln(" relay: %s (last changed: %v ago)", genStateString(s.Switch.Relay[:]), time.Since(s.Switch.RelayChanged)) - c.Sayln(" oc: %s (last changed: %v ago)", genStateString(s.Switch.OC[:]), time.Since(s.Switch.OCChanged)) + c.Sayln(" gpi: %s (last updated: %v ago)", genStateString(s.Switch.GPI[:]), time.Since(s.Switch.GPIUpdated)) + c.Sayln(" relay: %s (last updated: %v ago)", genStateString(s.Switch.Relay[:]), time.Since(s.Switch.RelayUpdated)) + c.Sayln(" oc: %s (last updated: %v ago)", genStateString(s.Switch.OC[:]), time.Since(s.Switch.OCUpdated)) c.Sayln("Server:") var names []string @@ -89,7 +89,7 @@ func telnetCmdState(c *telgo.Client, args []string, ctrl *SwitchControl) bool { } else { c.Say(" ") } - c.Sayln("%s(%s): '%s' (last changed: %v ago)", name, s.Server[name].Health, s.Server[name].Channel, time.Since(s.Server[name].Changed)) + c.Sayln("%s(%s): '%s' (last updated: %v ago)", name, s.Server[name].Health, s.Server[name].Channel, time.Since(s.Server[name].Updated)) } default: c.Sayln("invalid response of type %T: %+v", r, r) |