From e6358bf625f11386f899d852664932a650c1f467 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 10 Feb 2019 16:13:15 +0100 Subject: mixer: closer subscriber channel on unsubscribe --- pkg/mixer/mixer.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg') diff --git a/pkg/mixer/mixer.go b/pkg/mixer/mixer.go index c774342..4db2c3a 100644 --- a/pkg/mixer/mixer.go +++ b/pkg/mixer/mixer.go @@ -26,6 +26,7 @@ import ( "container/list" "errors" "fmt" + // "log" "strings" "github.com/scgolang/midi" @@ -126,6 +127,8 @@ func (m *Mixer) sendEvent(ev Event) { case ch <- ev: default: // subscriber is not respoding... + // log.Printf("mixer: removing subscriber '%v', because it is not responding", ch) + close(ch) subs.Remove(sub) } } @@ -214,5 +217,6 @@ func (m *Mixer) Subscribe(ch Channel, out chan<- Event) { m.subscribers[ch] = subs } + // log.Printf("mixer: subscribing '%v' to events for channel: %v", out, ch) subs.PushBack(out) } -- cgit v1.2.3