Fix panic when a streaming connection is closed (in multi-streams)
tagDone channels were not initialized for multiple tags streams.
--- a/cmd/stream.go Mon May 08 12:17:59 2017 +0200
+++ b/cmd/stream.go Mon May 08 20:31:29 2017 +0200
@@ -115,6 +115,7 @@
errPrint("Launching listener for tag '%s'", t)
}
tagEvCh[i] = make(chan madon.StreamEvent)
+ tagDoneCh[i] = make(chan bool)
e := gClient.StreamListener(streamName, t, tagEvCh[i], stop, tagDoneCh[i])
if e != nil {
if i > 0 { // Close previous connections
@@ -157,8 +158,8 @@
LISTEN:
for {
select {
- case _, ok := <-done:
- if !ok { // done is closed, end of streaming
+ case v, ok := <-done:
+ if !ok || v == true { // done is closed, end of streaming
break LISTEN
}
case ev := <-evChan: