summaryrefslogtreecommitdiff
path: root/src/rhctl/switch_control.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-03-30 03:36:11 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2016-03-30 03:36:11 (GMT)
commit1d0d0aea92c936bca8de0653b4c92a9bfd73f05c (patch)
tree30b2e26ad1f1146f0a7c9e1c6aec84e2f48d02fe /src/rhctl/switch_control.go
parenta8345a1ac7105a4393ab189e45c5ef0aead7577e (diff)
switched to different pubsub package
Diffstat (limited to 'src/rhctl/switch_control.go')
-rw-r--r--src/rhctl/switch_control.go10
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
}