discovery/gossiper: exit early on validation barrier quit

This commit is contained in:
Conner Fromknecht 2018-05-07 19:10:44 -07:00
parent 27ca61aedf
commit 3854c1ed68
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

View File

@ -906,13 +906,26 @@ func (d *AuthenticatedGossiper) networkHandler() {
// have thousands of goroutines active. // have thousands of goroutines active.
validationBarrier.InitJobDependencies(announcement.msg) validationBarrier.InitJobDependencies(announcement.msg)
d.wg.Add(1)
go func() { go func() {
defer d.wg.Done()
defer validationBarrier.CompleteJob() defer validationBarrier.CompleteJob()
// If this message has an existing dependency, // If this message has an existing dependency,
// then we'll wait until that has been fully // then we'll wait until that has been fully
// validated before we proceed. // validated before we proceed.
validationBarrier.WaitForDependants(announcement.msg) err := validationBarrier.WaitForDependants(
announcement.msg,
)
if err != nil {
if err != routing.ErrVBarrierShuttingDown {
log.Warnf("unexpected error "+
"during validation "+
"barrier shutdown: %v",
err)
}
return
}
// Process the network announcement to determine if // Process the network announcement to determine if
// this is either a new announcement from our PoV // this is either a new announcement from our PoV