diff options
author | Christian Pointner <equinox@spreadspace.org> | 2016-03-27 19:41:48 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2016-03-27 19:41:48 (GMT) |
commit | 3b9dc5639b9b26bb5a8e4324de47f77a00e0e86a (patch) | |
tree | aa70228a431945685a81ba711a72c8c6a3529e7a | |
parent | 6d2348f42b3e63109795c2d9578705d06b387cbb (diff) |
added SwitchCTRL
-rw-r--r-- | src/rhctl/main.go | 9 | ||||
-rw-r--r-- | src/rhctl/switch_control.go | 46 |
2 files changed, 55 insertions, 0 deletions
diff --git a/src/rhctl/main.go b/src/rhctl/main.go index 23a7f13..f529265 100644 --- a/src/rhctl/main.go +++ b/src/rhctl/main.go @@ -97,6 +97,8 @@ func main() { return } + ctrl := SwitchControlInit(conf, sw, servers) + // running essential parts stop := make(chan bool) @@ -116,6 +118,13 @@ func main() { }(server) } + go func() { + rhl.Printf("starting switch control") + ctrl.Run() + rhl.Printf("switch control has stopped") + stop <- true + }() + <-stop rhl.Printf("at least one essential part has stopped - bringing down the whole process") } diff --git a/src/rhctl/switch_control.go b/src/rhctl/switch_control.go new file mode 100644 index 0000000..de5bf6d --- /dev/null +++ b/src/rhctl/switch_control.go @@ -0,0 +1,46 @@ +// +// rhctl +// +// Copyright (C) 2009-2016 Christian Pointner <equinox@helsinki.at> +// +// This file is part of rhctl. +// +// rhctl is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// rhctl is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with rhctl. If not, see <http://www.gnu.org/licenses/>. +// + +package main + +import ( + "time" +) + +type SwitchControl struct { + sw *AudioSwitch + servers []*PlayoutServer +} + +func (sw *SwitchControl) Run() { + rhdl.Printf("SwitchCTRL: handler running...") + + for { + time.Sleep(time.Second) + } +} + +func SwitchControlInit(conf *Config, sw *AudioSwitch, servers []*PlayoutServer) (ctrl *SwitchControl) { + ctrl = &SwitchControl{} + ctrl.sw = sw + ctrl.servers = servers + return +} |