Browse Source

Merge pull request #676 from sanimej/bfix

Fix the daemon panic on consul server restart
Madhu Venugopal 9 years ago
parent
commit
d8e14c9efc
1 changed files with 7 additions and 0 deletions
  1. 7 0
      libnetwork/datastore/datastore.go

+ 7 - 0
libnetwork/datastore/datastore.go

@@ -265,6 +265,13 @@ func (ds *datastore) Watch(kvObject KVObject, stopCh <-chan struct{}) (<-chan KV
 				close(sCh)
 				return
 			case kvPair := <-kvpCh:
+				// If the backend KV store gets reset libkv's go routine
+				// for the watch can exit resulting in a nil value in
+				// channel.
+				if kvPair == nil {
+					close(sCh)
+					return
+				}
 				dstO := ctor.New()
 
 				if err := dstO.SetValue(kvPair.Value); err != nil {