Merge pull request #955 from halseth/neutrinonotify-epoch-queue

[small] neutrinonotify: use epochqueue to notify block epochs
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2018-04-02 16:23:14 -07:00
commit 47a1d3f9e5
1 file changed
+3 -13
+3 -13
View File
@@ -528,24 +528,14 @@ func (n *NeutrinoNotifier) notifyBlockEpochs(newHeight int32, newSha *chainhash.
} }
for _, epochClient := range n.blockEpochClients { for _, epochClient := range n.blockEpochClients {
n.wg.Add(1)
epochClient.wg.Add(1)
go func(ntfnChan chan *chainntnfs.BlockEpoch, cancelChan chan struct{},
clientWg *sync.WaitGroup) {
defer clientWg.Done()
defer n.wg.Done()
select { select {
case ntfnChan <- epoch:
case <-cancelChan: case epochClient.epochQueue.ChanIn() <- epoch:
return
case <-epochClient.cancelChan:
case <-n.quit: case <-n.quit:
return
} }
}(epochClient.epochChan, epochClient.cancelChan, &epochClient.wg)
} }
} }