diff options
Diffstat (limited to 'src/rhctl/switch_control.go')
-rw-r--r-- | src/rhctl/switch_control.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rhctl/switch_control.go b/src/rhctl/switch_control.go index 82faec8..df3dce9 100644 --- a/src/rhctl/switch_control.go +++ b/src/rhctl/switch_control.go @@ -22,7 +22,7 @@ package main import ( - "github.com/olebedev/emitter" + "github.com/btittelbach/pubsub" ) type CommandType uint8 @@ -53,7 +53,7 @@ type Command struct { type SwitchControl struct { sw *AudioSwitch servers []*PlayoutServer - Updates *emitter.Emitter + Updates *pubsub.PubSub Commands chan *Command } @@ -88,10 +88,10 @@ func (ctrl *SwitchControl) Run() { for _, srv := range ctrl.servers { srv.SwitchUpdates <- update } - ctrl.Updates.Emit("switch:"+update.Type.String(), update) + ctrl.Updates.Pub(update, "switch:"+update.Type.String()) case status := <-serverUpdates: rhdl.Printf("got server status update: %+v", status) - ctrl.Updates.Emit("server:status", status) + ctrl.Updates.Pub(status, "server:status") // TODO: recalculate overall status and send out commands to switch case cmd := <-ctrl.Commands: ctrl.handleCommand(cmd) @@ -103,7 +103,7 @@ func SwitchControlInit(conf *Config, sw *AudioSwitch, servers []*PlayoutServer) ctrl = &SwitchControl{} ctrl.sw = sw ctrl.servers = servers - ctrl.Updates = emitter.New(32) + ctrl.Updates = pubsub.NewNonBlocking(32) ctrl.Commands = make(chan *Command, 8) return } |