From 3b9dc5639b9b26bb5a8e4324de47f77a00e0e86a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 27 Mar 2016 21:41:48 +0200 Subject: added SwitchCTRL 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 +// +// 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 . +// + +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 +} -- cgit v0.10.2