From f97437ba7e7c8ec9169be0d1e6aa9e1424836706 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 27 Dec 2014 17:08:28 +0000
Subject: [PATCH] do not reload icecast until the masterelection protocol has
 reached consensus

---
 node/node.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/node/node.go b/node/node.go
index ac9a3125..8311e1a1 100644
--- a/node/node.go
+++ b/node/node.go
@@ -348,6 +348,13 @@ func (rc *RadioNode) updater(stop chan bool) {
 	for {
 		select {
 		case <-rc.upch:
+			// We may have received an update before the
+			// masterelection had time to actually elect a
+			// master. In this case, skip.
+			if !rc.me.Valid() {
+				continue
+			}
+
 			icecastReloads.Incr()
 			rc.Log.Printf("reloading icecast config")
 			if err := rc.icecast.Update(rc.config, rc.me.IsMaster(), rc.getMasterAddr()); err != nil {
-- 
GitLab