diff options
Diffstat (limited to 'src/rhctl/playout_server.go')
-rw-r--r-- | src/rhctl/playout_server.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/rhctl/playout_server.go b/src/rhctl/playout_server.go index adba52d..ca00611 100644 --- a/src/rhctl/playout_server.go +++ b/src/rhctl/playout_server.go @@ -44,7 +44,7 @@ func (s ServerHealth) String() string { return "unknown" } -type ServerStatus struct { +type ServerState struct { Name string Health ServerHealth Channel string @@ -58,8 +58,8 @@ type PlayoutServer struct { hbtimer *time.Timer hbthreshold uint hbcnt uint - status ServerStatus - Updates chan ServerStatus + state ServerState + StateChanges chan ServerState UpdateRequest chan bool SwitchUpdates chan SwitchUpdate } @@ -72,8 +72,8 @@ func (srv *PlayoutServer) handleControl(data string) { rhl.Printf("Server(%s) sent empty channel name", srv.name) return } - srv.status.Channel = data[8:] - srv.Updates <- srv.status + srv.state.Channel = data[8:] + srv.StateChanges <- srv.state return } rhl.Printf("Server(%s): ignoring unknown control message: %q", srv.name, data) @@ -87,12 +87,12 @@ func (srv *PlayoutServer) handleHeartbeat(data string) { return } - old := srv.status.Health - srv.status.Health = ServerAlive - if old != srv.status.Health { - srv.Updates <- srv.status + old := srv.state.Health + srv.state.Health = ServerAlive + if old != srv.state.Health { + srv.StateChanges <- srv.state rhl.Printf("Server(%s): is back from the dead!", srv.name) - if srv.status.Channel == "" { + if srv.state.Channel == "" { srv.control.tx <- "channel ?" } } @@ -101,8 +101,8 @@ func (srv *PlayoutServer) handleHeartbeat(data string) { func (srv *PlayoutServer) handleHBTimeout() { rhl.Printf("Server(%s): heartbeat timed-out", srv.name) srv.hbcnt = 0 - srv.status.Health = ServerDead - srv.Updates <- srv.status + srv.state.Health = ServerDead + srv.StateChanges <- srv.state } func (srv *PlayoutServer) Run() { @@ -124,8 +124,8 @@ func (srv *PlayoutServer) Run() { case <-srv.hbtimer.C: srv.handleHBTimeout() case <-srv.UpdateRequest: - if srv.status.Health == ServerDead { - srv.Updates <- srv.status + if srv.state.Health == ServerDead { + srv.StateChanges <- srv.state } else { srv.control.tx <- "channel ?" } @@ -146,10 +146,10 @@ func ServerInit(name string, conf *Config) (srv *PlayoutServer, err error) { if conf.Servers[name].HeartbeatThreshold > 0 { srv.hbthreshold = conf.Servers[name].HeartbeatThreshold } - srv.status.Name = srv.name - srv.status.Health = ServerDead - srv.status.Channel = "" - srv.Updates = make(chan ServerStatus, 8) + srv.state.Name = srv.name + srv.state.Health = ServerDead + srv.state.Channel = "" + srv.StateChanges = make(chan ServerState, 16) srv.UpdateRequest = make(chan bool, 8) srv.SwitchUpdates = make(chan SwitchUpdate, 32) |