summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-14 20:03:00 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-14 20:03:00 +0100
commit1dd2b0a9ea1119139fdbd97d6ac810c7ddb5698f (patch)
tree51dc0ef0a74f560cb01f054446a345814f96992a /cmd
parentmake code a little nicer (diff)
make subscribtions thread safe and more bullet proof
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dolmetschctl/dolmetschctl.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/dolmetschctl/dolmetschctl.go b/cmd/dolmetschctl/dolmetschctl.go
index 9e878a8..86fde95 100644
--- a/cmd/dolmetschctl/dolmetschctl.go
+++ b/cmd/dolmetschctl/dolmetschctl.go
@@ -122,7 +122,8 @@ func handleWebSocketMessage(ctrl *controller.Controller, ws *websocket.Conn, msg
func run(ctrl *controller.Controller, ws *websocket.Conn) error {
ctrlCh := make(chan controller.Event, 100)
- ctrl.Subscribe(ctrlCh)
+ unsub := ctrl.Subscribe(ctrlCh)
+ defer close(unsub)
wsCh := make(chan types.WebSocketResponseFull)
go wsReader(ws, wsCh)