From afbd5f2f692e6630280de17a284bc4c72df6084a Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 29 Jul 2017 02:06:38 +0200 Subject: [PATCH] refactor: direttoforo.State --- cmd/direttoforo/main.go | 17 +++++------------ direttoforo.go | 13 +++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 direttoforo.go diff --git a/cmd/direttoforo/main.go b/cmd/direttoforo/main.go index 69b296b..e6e2156 100644 --- a/cmd/direttoforo/main.go +++ b/cmd/direttoforo/main.go @@ -8,26 +8,17 @@ import ( "os/signal" "time" + "git.lattuga.net/boyska/direttoforo" "git.lattuga.net/boyska/direttoforo/liquidsoap" "git.lattuga.net/boyska/direttoforo/uiserver" ) -type State struct { - Streams map[string]liquidsoap.Stream -} - -func NewState() State { - s := State{} - s.Streams = make(map[string]liquidsoap.Stream) - return s -} - func main() { liqfile := flag.String("liq", "foo.liq", "Path to liquidsoap script to run") bindpath := flag.String("bindpath", "/var/lib/direttoforo/ui.sock", "UNIX domain socket path for UIs") flag.Parse() - state := NewState() + state := direttoforo.NewState() netUIsock, err := net.Listen("unix", *bindpath) if err != nil { @@ -74,7 +65,9 @@ func main() { t.Conn.SetDeadline(time.Now().Add(3 * time.Second)) outs, err := t.Outputs() if err != nil { - fmt.Println("telnet cmd errored", err) + if err.Error() != "EOF" { + fmt.Println("telnet cmd errored", err) + } continue } changed := false diff --git a/direttoforo.go b/direttoforo.go new file mode 100644 index 0000000..9488b76 --- /dev/null +++ b/direttoforo.go @@ -0,0 +1,13 @@ +package direttoforo + +import "git.lattuga.net/boyska/direttoforo/liquidsoap" + +type State struct { + Streams map[string]liquidsoap.Stream +} + +func NewState() State { + s := State{} + s.Streams = make(map[string]liquidsoap.Stream) + return s +}